fix: extract field out so that create will not error
This commit is contained in:
parent
5f96541c08
commit
c09a15b858
1 changed files with 4 additions and 2 deletions
|
|
@ -129,6 +129,8 @@ export class TaskController extends Controller {
|
||||||
|
|
||||||
const code = `PO${year}${month}${last.value.toString().padStart(6, "0")}`;
|
const code = `PO${year}${month}${last.value.toString().padStart(6, "0")}`;
|
||||||
|
|
||||||
|
const { requestWork, ...rest } = body;
|
||||||
|
|
||||||
await tx.taskOrder.create({
|
await tx.taskOrder.create({
|
||||||
include: {
|
include: {
|
||||||
taskList: {
|
taskList: {
|
||||||
|
|
@ -141,11 +143,11 @@ export class TaskController extends Controller {
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
...body,
|
...rest,
|
||||||
code,
|
code,
|
||||||
createdByUserId: req.user.sub,
|
createdByUserId: req.user.sub,
|
||||||
taskList: {
|
taskList: {
|
||||||
connect: body.requestWork.map((v) => ({ step_requestWorkId: v })),
|
connect: requestWork.map((v) => ({ step_requestWorkId: v })),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue