Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Invoice edit returns 500 bad request if invoice is paid #327

Closed
CodeNamedRobin opened this issue Sep 17, 2024 · 2 comments
Closed

Comments

@CodeNamedRobin
Copy link
Contributor

Current behavior

When patching an invoice, in this case it's settings, the backend returns a 500 if the invoice is paid.

Desired behavior

I expected to either be able to edit the invoice, or get a different error code.

API Route

PATCH /invoices/{id}

Steps to reproduce

I went to invoice 132, patched the description, got 500 back.

Logs and Error Messages

[2024-09-17T14:47:26.312] [ERROR] InvoiceController - Could not update invoice: TypeError: Cannot read properties of undefined (reading 'id')

2024-09-17T12:47:26.369878284Z 4|http-worker | at Function.asBaseInvoiceResponse (/app/src/service/invoice-service.ts:133:19)

2024-09-17T12:47:26.369950741Z 4|http-worker | at InvoiceController.updateInvoice (/app/src/controller/invoice-controller.ts:290:31)

2024-09-17T12:47:26.370057152Z 4|http-worker | at processTicksAndRejections (node:internal/process/task_queues:95:5)

2024-09-17T12:47:26.370403561Z 4|http-worker | [2024-09-17T14:47:26.312] [ERROR] InvoiceController - Could not update invoice: TypeError: Cannot read properties of undefined (reading 'id')

2024-09-17T12:47:26.370536737Z 4|http-worker | at Function.asBaseInvoiceResponse (/app/src/service/invoice-service.ts:133:19)

2024-09-17T12:47:26.370655218Z 4|http-worker | at InvoiceController.updateInvoice (/app/src/controller/invoice-controller.ts:290:31)

2024-09-17T12:47:26.370779581Z 4|http-worker | at processTicksAndRejections (node:internal/process/task_queues:95:5)

2024-09-17T12:47:26.959111027Z 0|http-worker | [2024-09-17T14:47:26.956] [TRACE] InvoiceController - Update Invoice { description: 'SudoSOS debt from IntroductionWeek 2023, Group CS20.' } by user {
...

Other Information

No response

@JustSamuel
Copy link
Contributor

By design, if the invoice is paid it has been sent. If the other company already paid your invoice, it would make almost no sense to edit it.

@JustSamuel
Copy link
Contributor

I agree that the error might be nicer, but that will be fixed in #326, so closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants