fix: error not valid json payload

This commit is contained in:
Methapon2001 2025-01-13 09:55:39 +07:00
parent f1d4584d02
commit eca99dbcd1

View file

@ -540,7 +540,7 @@ export class CreditNoteActionController extends Controller {
async updateStatus( async updateStatus(
@Request() req: RequestWithUser, @Request() req: RequestWithUser,
@Path() creditNoteId: string, @Path() creditNoteId: string,
@Body() body: PaybackStatus, @Body() body: { paybackStatus: PaybackStatus },
) { ) {
await this.#checkPermission(req.user, creditNoteId); await this.#checkPermission(req.user, creditNoteId);
return await prisma.creditNote.update({ return await prisma.creditNote.update({
@ -554,8 +554,9 @@ export class CreditNoteActionController extends Controller {
quotation: true, quotation: true,
}, },
data: { data: {
creditNoteStatus: body === PaybackStatus.Done ? CreditNoteStatus.Success : undefined, creditNoteStatus:
paybackStatus: body, body.paybackStatus === PaybackStatus.Done ? CreditNoteStatus.Success : undefined,
paybackStatus: body.paybackStatus,
}, },
}); });
} }