refactor: map responsible area to string array

This commit is contained in:
Methapon Metanipat 2024-11-05 09:46:52 +07:00
parent 8c02f31d16
commit 670fa1bfac

View file

@ -294,6 +294,7 @@ export class UserController extends Controller {
prisma.user.findMany({
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
include: {
responsibleArea: true,
province: true,
district: true,
subDistrict: true,
@ -311,6 +312,7 @@ export class UserController extends Controller {
return {
result: result.map((v) => ({
...v,
responsibleArea: v.responsibleArea.map((v) => v.area),
branch: includeBranch ? v.branch.map((a) => a.branch) : undefined,
})),
page,