feat: add booking sample application#2
Conversation
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…kings projections Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wires KurrentDB client, codec, event store, functional command service with three handlers, in-memory read model, catch-up subscription with logging middleware, and HTTP server with graceful shutdown. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…HTTP tests Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b28ab5715d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if state.Paid { | ||
| return nil, ErrBookingAlreadyPaid | ||
| } | ||
| return []any{ | ||
| PaymentRecorded{ |
There was a problem hiding this comment.
Reject invalid payment amounts before recording event
HandleRecordPayment only checks cancellation/paid flags and then always emits PaymentRecorded with cmd.Amount. This allows amount <= 0 (which can increase outstanding balance) and amount > state.Outstanding (which drives outstanding negative), so write-side state and API responses can become financially invalid for a booking.
Useful? React with 👍 / 👎.
| BookingID: cmd.BookingID, | ||
| Amount: cmd.Amount, | ||
| Currency: cmd.Currency, | ||
| PaymentID: cmd.PaymentID, |
There was a problem hiding this comment.
Enforce payment currency matches booking currency
The payment handler never validates cmd.Currency against state.Currency before recording the event, so a booking priced in one currency can be marked paid by a payment in another currency without conversion. That produces incorrect balances whenever clients submit a mismatched currency code.
Useful? React with 👍 / 👎.
|
/review |
Summary
samples/booking/) demonstrating the full Eventuous Go event sourcing cycle: commands → events → store → subscribe → project → querynet/http, graceful shutdown, error mapping-raceTest plan
go test -race ./...passes insamples/booking/gofmt -lcleango vet ./...cleancoremodule tests unaffectedKURRENTDB_URL=esdb://localhost:2113?tls=false go run .)🤖 Generated with Claude Code