Repository navigation
Conversation
- Add ReceiptStatus, ReceiptAction and ReceiptStateMachine in Core - Add the status column on receipts and the receipt_status_changes table, with the AddReceiptStatus migration and its SQL script - Add one endpoint per action; check the state machine, the reason and that the submitter does not approve, then save the status and its history in one transaction - Return 409 with the allowed actions for an invalid or concurrent change, 400 for a missing reason, 403 for self-approval, 404 for an unknown receipt - Document the statuses in docs/database/receipt-statuses.md, with a test that keeps the diagram in sync with the code
Renumber the receipt status SQL script to 0008, since 0007 is now the catalog quality class migration from #88.
anis022
requested changes
Nov 24, 2026
anis022
left a comment
Member
There was a problem hiding this comment.
Nice work, the numbering itself looks solid, the counter lock and the rollback prevent duplicates and gaps. I left one comment on the migration backfill to fix before merging.
| FROM ( | ||
| SELECT id, row_number() OVER (ORDER BY created_at, id) AS position | ||
| FROM receipts | ||
| WHERE status = 'Issued' |
Member
There was a problem hiding this comment.
The backfill only numbers receipts with status = 'Issued', ordered by created_at. Since #90, a receipt can be issued and then cancelled, so it gets no number, and the others follow the creation order instead of the issue order. Can we number every receipt that has a receipt_status_changes row with to_status = 'Issued', ordered by its changed_at? Same fix in 0009_add_receipt_numbers.sql.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #32
Overview
Gives each receipt a unique number when it is issued, with no duplicates and no gaps, even when several receipts are issued at the same time.
Format:
DEN_000001(seriesDEN_for food donations + 6 digits, continuous across years). It follows the style of the existing money donation receipts (WEB_056836), but uses its own series so that two receipts of the organization never share a number. To confirm with Nafissa.Testing
dotnet test: 615/615 passing (Docker required for the integration tests).Checklist
Notes
DEN_series is still to be confirmed with Nafissa. Changing it means updatingReceiptNumber.csand adding a migration, since the database checks the format.