feat: add cancel only and quotation id filter
This commit is contained in:
parent
659fb325b1
commit
d37f527f7d
1 changed files with 13 additions and 1 deletions
|
|
@ -292,6 +292,8 @@ export class RequestListController extends Controller {
|
||||||
@Query() requestDataId?: string,
|
@Query() requestDataId?: string,
|
||||||
@Query() workStatus?: RequestWorkStatus,
|
@Query() workStatus?: RequestWorkStatus,
|
||||||
@Query() readyToTask?: boolean,
|
@Query() readyToTask?: boolean,
|
||||||
|
@Query() cancelOnly?: boolean,
|
||||||
|
@Query() quotationId?: string,
|
||||||
) {
|
) {
|
||||||
let statusCondition: Prisma.RequestWorkWhereInput["stepStatus"] = {};
|
let statusCondition: Prisma.RequestWorkWhereInput["stepStatus"] = {};
|
||||||
|
|
||||||
|
|
@ -313,7 +315,15 @@ export class RequestListController extends Controller {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
} else {
|
}
|
||||||
|
|
||||||
|
if (cancelOnly) {
|
||||||
|
statusCondition = {
|
||||||
|
some: { workStatus: RequestWorkStatus.Canceled },
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (workStatus && !readyToTask && !cancelOnly) {
|
||||||
statusCondition = {
|
statusCondition = {
|
||||||
some: { workStatus },
|
some: { workStatus },
|
||||||
};
|
};
|
||||||
|
|
@ -321,8 +331,10 @@ export class RequestListController extends Controller {
|
||||||
|
|
||||||
const where = {
|
const where = {
|
||||||
stepStatus: readyToTask || workStatus ? statusCondition : undefined,
|
stepStatus: readyToTask || workStatus ? statusCondition : undefined,
|
||||||
|
creditNote: cancelOnly ? null : undefined,
|
||||||
request: {
|
request: {
|
||||||
id: requestDataId,
|
id: requestDataId,
|
||||||
|
quotationId,
|
||||||
quotation: {
|
quotation: {
|
||||||
registeredBranch: { OR: permissionCond(req.user) },
|
registeredBranch: { OR: permissionCond(req.user) },
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue