fix: error constraints

fix: error constraints
This commit is contained in:
Methapon Metanipat 2024-11-25 15:19:06 +07:00
parent 990a4687fd
commit e29ee46a2a

View file

@ -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,