feat(budget): attach receipts and invoices to expenses - #2268
Conversation
|
Thanks for this, and for building it the right way round. You hung it on the existing A few things need to happen before it can go in, and none of the CI jobs that would have told you have run yet (only Blocking
Worth fixing while you are in there
Happy to look again once CI is green on it. |
1767e1c to
c6befa0
Compare
|
Thanks for the nice review and helpful feedback! I've addressed all issues and your suggestions in the latest push: 1. Client Typecheck (
|
Attaching a receipt no longer lets the budget domain delete one. Trashing the file was reachable from the REST route, the MCP tool and the plugin RPC, none of which check file_delete, and a receipt id is any file on the trip, so anyone who could edit an expense could trash a document they were not allowed to touch. A concurrent edit could do it by accident: the client sends the full set of receipt ids from a snapshot taken when the form opened, so saving an expense someone else had just attached a file to moved that file to the trash. Removing a receipt now removes the link and nothing else. The link row is treated as shared, because it is. One row can tie a file to a place and to an expense at once, so the sync clears only the receipt half and leaves the rest, the foreign key is SET NULL rather than CASCADE, and a receipt already in the trash keeps its link so restoring it comes back attached. The upload and its rollback moved into one module both shells call. It was copied into six places, and all six rolled back with the permanent-delete route, which only accepts a file that is already in the trash and therefore answered 404 every time: a failed save left every uploaded file on the trip, attached to the expense, and the next attempt uploaded another copy. It now trashes first, keeps the pending files for the retry, and says so when a file could not be removed instead of swallowing it. Escape in the receipt viewer no longer closes the expense form behind it, the download fallback uses a real accent class rather than a utility that does not exist, and the upload indicator is actually switched on. Tests: the receipt link behaviour on both service paths, the four new branches in the files service, the upload module, and the viewer.
c6befa0 to
3b192a2
Compare
listFiles projects linked_budget_item_ids now, so the harness table it selects from needs budget_item_id or every list call in that file answers 500. Same gap the collab harness had.
Description
Allows attaching receipts and invoices (images & PDFs) directly to expenses in both Desktop and Mobile views.
[ 🧾 Beleg ]/[ 🧾 Belege (3) ]) in the expense ledger rows.Related Issue or Discussion
none
Type of Change
Checklist
devdevbranch, notmain(wiki-only PRs are exempt)