diff --git a/src/controllers/04-service-controller.ts b/src/controllers/04-service-controller.ts index b76c110..80b5f2b 100644 --- a/src/controllers/04-service-controller.ts +++ b/src/controllers/04-service-controller.ts @@ -412,11 +412,14 @@ export class ServiceController extends Controller { order: wIdx + 1, attributes: w.attributes, productOnWork: { - create: w.product.map((p, pIdx) => ({ - productId: p.id, - installmentNo: p.installmentNo, - order: pIdx + 1, - })), + createMany: { + data: w.product.map((p, pIdx) => ({ + productId: p.id, + installmentNo: p.installmentNo, + order: pIdx + 1, + })), + skipDuplicates: true, + }, }, }, update: { @@ -424,6 +427,7 @@ export class ServiceController extends Controller { order: wIdx + 1, attributes: w.attributes, productOnWork: { + deleteMany: {}, create: w.product.map((p, pIdx) => ({ productId: p.id, installmentNo: p.installmentNo,