feat: add set task status
This commit is contained in:
parent
fb7817da38
commit
1244b56738
1 changed files with 31 additions and 0 deletions
|
|
@ -462,6 +462,37 @@ export class TaskActionController extends Controller {
|
|||
]);
|
||||
}
|
||||
|
||||
@Post("set-task-status")
|
||||
@Security("keycloak")
|
||||
async changeTaskOrderTaskListStatus(
|
||||
@Request() req: RequestWithUser,
|
||||
@Path() taskId: string,
|
||||
@Body()
|
||||
body: {
|
||||
step: number;
|
||||
requestWorkId: string;
|
||||
taskStatus: TaskStatus;
|
||||
}[],
|
||||
) {
|
||||
return await prisma.$transaction(async (tx) => {
|
||||
const promises = body.map(async (v) => {
|
||||
const record = await tx.task.findFirst({
|
||||
where: {
|
||||
step: v.step,
|
||||
requestWorkId: v.requestWorkId,
|
||||
taskOrderId: taskId,
|
||||
},
|
||||
});
|
||||
if (!record) throw notFoundError("Task List");
|
||||
return await tx.task.update({
|
||||
where: { id: record.id },
|
||||
data: { taskStatus: v.taskStatus },
|
||||
});
|
||||
});
|
||||
return await Promise.all(promises);
|
||||
});
|
||||
}
|
||||
|
||||
@Post("submit")
|
||||
@Security("keycloak")
|
||||
async submitTaskOrder(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue