feat: prevent request work that already issued credit note
This commit is contained in:
parent
f4ded1692d
commit
26c9705b18
1 changed files with 2 additions and 0 deletions
|
|
@ -204,6 +204,7 @@ export class CreditNoteController extends Controller {
|
||||||
async createCreditNote(@Request() req: RequestWithUser, @Body() body: CreditNoteCreate) {
|
async createCreditNote(@Request() req: RequestWithUser, @Body() body: CreditNoteCreate) {
|
||||||
const requestWork = await prisma.requestWork.findMany({
|
const requestWork = await prisma.requestWork.findMany({
|
||||||
where: {
|
where: {
|
||||||
|
creditNote: null,
|
||||||
request: {
|
request: {
|
||||||
quotation: {
|
quotation: {
|
||||||
id: body.quotationId,
|
id: body.quotationId,
|
||||||
|
|
@ -310,6 +311,7 @@ export class CreditNoteController extends Controller {
|
||||||
|
|
||||||
const requestWork = await prisma.requestWork.findMany({
|
const requestWork = await prisma.requestWork.findMany({
|
||||||
where: {
|
where: {
|
||||||
|
OR: [{ creditNote: null }, { creditNoteId }],
|
||||||
request: {
|
request: {
|
||||||
quotation: {
|
quotation: {
|
||||||
id: body.quotationId,
|
id: body.quotationId,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue