add responsibleGroup in step

This commit is contained in:
Kanjana 2025-04-24 11:40:02 +07:00
parent 1d6224da73
commit 109494c6d7
3 changed files with 33 additions and 0 deletions

View file

@ -37,6 +37,7 @@ type WorkflowPayload = {
attributes?: { [key: string]: any };
responsiblePersonId?: string[];
responsibleInstitution?: string[];
responsibleGroup?: string[];
messengerByArea?: boolean;
}[];
registeredBranchId?: string;
@ -89,6 +90,7 @@ export class FlowTemplateController extends Controller {
include: { user: true },
},
responsibleInstitution: true,
responsibleGroup: true,
},
orderBy: { order: "asc" },
},
@ -106,6 +108,7 @@ export class FlowTemplateController extends Controller {
step: r.step.map((v) => ({
...v,
responsibleInstitution: v.responsibleInstitution.map((institution) => institution.group),
responsibleGroup: v.responsibleGroup.map((group) => group.group),
})),
})),
page,
@ -126,6 +129,7 @@ export class FlowTemplateController extends Controller {
include: { user: true },
},
responsibleInstitution: true,
responsibleGroup: true,
},
},
},
@ -140,6 +144,7 @@ export class FlowTemplateController extends Controller {
step: record.step.map((v) => ({
...v,
responsibleInstitution: v.responsibleInstitution.map((institution) => institution.group),
responsibleGroup: v.responsibleGroup.map((group) => group.group),
})),
};
}
@ -215,6 +220,9 @@ export class FlowTemplateController extends Controller {
responsibleInstitution: {
create: v.responsibleInstitution?.map((group) => ({ group })),
},
responsibleGroup: {
create: v.responsibleGroup?.map((group) => ({ group })),
},
})),
},
},
@ -295,6 +303,10 @@ export class FlowTemplateController extends Controller {
deleteMany: {},
create: v.responsibleInstitution?.map((group) => ({ group })),
},
responsibleGroup: {
deleteMany: {},
create: v.responsibleGroup?.map((group) => ({ group })),
},
},
})),
},