fix: error when no ids

This commit is contained in:
Methapon Metanipat 2024-11-25 15:14:42 +07:00
parent 6580c17273
commit 990a4687fd

View file

@ -402,11 +402,9 @@ export class ServiceController extends Controller {
...payload,
statusOrder: +(payload.status === "INACTIVE"),
work: {
deleteMany: {
id: work?.some((v) => !!v.id)
? { notIn: work.flatMap((v) => (!!v.id ? v.id : [])) }
: undefined,
},
deleteMany: work?.some((v) => !!v.id)
? { id: { notIn: work.flatMap((v) => (!!v.id ? v.id : [])) } }
: {},
upsert: (work || []).map((w, wIdx) => ({
where: { id: w.id },
create: {