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() workStatus?: RequestWorkStatus,
|
||||
@Query() readyToTask?: boolean,
|
||||
@Query() cancelOnly?: boolean,
|
||||
@Query() quotationId?: string,
|
||||
) {
|
||||
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 = {
|
||||
some: { workStatus },
|
||||
};
|
||||
|
|
@ -321,8 +331,10 @@ export class RequestListController extends Controller {
|
|||
|
||||
const where = {
|
||||
stepStatus: readyToTask || workStatus ? statusCondition : undefined,
|
||||
creditNote: cancelOnly ? null : undefined,
|
||||
request: {
|
||||
id: requestDataId,
|
||||
quotationId,
|
||||
quotation: {
|
||||
registeredBranch: { OR: permissionCond(req.user) },
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue