Repository navigation
fix(backoffice): rechazar importes negativos, facturas duplicadas y fechas de pago imposibles - #23
Merged
bpstack merged 3 commits intoOct 12, 2026
Conversation
…ssible payment dates - validations/backoffice/invoice.ts: the rules decided on 2026-10-11. An amount is a number or the DECIMAL string the API returns, never negative; a payment date is a real day between the invoice date and today. - Create and edit answer 400 BACKOFFICE_INVALID_AMOUNT for a negative or non-numeric amount, and 409 BACKOFFICE_INVOICE_DUPLICATE when the supplier already has an invoice with that number. - Pay answers 400 BACKOFFICE_INVALID_PAYMENT_DATE for a date before the invoice, in the future or that does not exist. - Migration 20261012_unique_invoice_supplier_number.sql adds the unique key (applied locally; pending on Aiven) and its row in INDEX.md. - error-codes.ts, errors.json (es, en), errorCodeMessage.ts: the three codes. - docs/backoffice: the new rules, and the two decisions to keep deleting permanent and validation without a stamped PDF. - invoice-rules.test.ts: the rules, the controller and the migration. Why: negative amounts, the same invoice twice (both paid in the monthly batch) and any payment date were saved. Checked with curl against the local database: all three were accepted before and are refused now, and an edit that sends the amounts back as strings still saves.
…Aiven - INDEX.md: the migration row now reads applied on local and Aiven. Why: it was applied on Aiven on 2026-10-12 after a dry run and read-only checks of its preconditions, and verified afterwards.
…of' into opencode/fix-backoffice-invoices # Conflicts: # backend/db-mysql/INDEX.md
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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.
Cambios
BACKOFFICE_INVOICE_DUPLICATE) y una fecha de pago imposible.20261012_unique_invoice_supplier_number.sql(clave única), ya aplicada en Aiven el 2026-10-12;INDEX.mdactualizado.Por qué
La misma factura se podía registrar dos veces y se pagaban las dos en el lote mensual. Decidido el 2026-10-11.