feat: add ready to task filter

This commit is contained in:
Methapon2001 2024-12-04 14:25:56 +07:00
parent 9b2db72c4d
commit a86035a003

View file

@ -183,9 +183,24 @@ export class RequestListController extends Controller {
@Query() pageSize: number = 30,
@Query() requestDataId?: string,
@Query() workStatus?: RequestWorkStatus,
@Query() readyToTask?: boolean,
) {
let statusCondition: Prisma.RequestWorkWhereInput["stepStatus"] = {};
if (readyToTask) {
statusCondition = {
some: {
OR: [{ workStatus: RequestWorkStatus.Ready }, { workStatus: RequestWorkStatus.Redo }],
},
};
} else {
statusCondition = {
some: { workStatus },
};
}
const where = {
stepStatus: workStatus ? { some: { workStatus } } : undefined,
stepStatus: workStatus ? statusCondition : undefined,
request: {
id: requestDataId,
quotation: {