feat: prevent request work that already issued credit note

This commit is contained in:
Methapon2001 2025-01-06 15:18:10 +07:00
parent f4ded1692d
commit 26c9705b18

View file

@ -204,6 +204,7 @@ export class CreditNoteController extends Controller {
async createCreditNote(@Request() req: RequestWithUser, @Body() body: CreditNoteCreate) {
const requestWork = await prisma.requestWork.findMany({
where: {
creditNote: null,
request: {
quotation: {
id: body.quotationId,
@ -310,6 +311,7 @@ export class CreditNoteController extends Controller {
const requestWork = await prisma.requestWork.findMany({
where: {
OR: [{ creditNote: null }, { creditNoteId }],
request: {
quotation: {
id: body.quotationId,