feat: prevent reaccept debit note
This commit is contained in:
parent
feffe6d52f
commit
b45753da2a
1 changed files with 5 additions and 1 deletions
|
|
@ -843,7 +843,11 @@ export class DebitNoteActionController extends Controller {
|
|||
@Post("accept")
|
||||
@Security("keycloak", MANAGE_ROLES)
|
||||
async acceptDebitNote(@Request() req: RequestWithUser, @Path() debitNoteId: string) {
|
||||
await this.#checkPermission(req.user, debitNoteId);
|
||||
const record = await this.#checkPermission(req.user, debitNoteId);
|
||||
|
||||
if (record.quotationStatus !== QuotationStatus.Issued) {
|
||||
throw new HttpError(HttpStatus.BAD_REQUEST, "Already Accepted", "debitNoteAlreadyAccept");
|
||||
}
|
||||
return await prisma.quotation.update({
|
||||
where: { id: debitNoteId },
|
||||
data: { quotationStatus: QuotationStatus.Accepted },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue