diff --git a/src/controllers/branch/branch-controller.ts b/src/controllers/branch/branch-controller.ts index 197ec21..20828b1 100644 --- a/src/controllers/branch/branch-controller.ts +++ b/src/controllers/branch/branch-controller.ts @@ -127,6 +127,11 @@ export class BranchController extends Controller { const { provinceId, districtId, subDistrictId, headOfficeId, ...rest } = body; return await prisma.branch.create({ + include: { + province: true, + district: true, + subDistrict: true, + }, data: { ...rest, isHeadOffice: headOfficeId === null, @@ -198,7 +203,14 @@ export class BranchController extends Controller { @Delete("{branchId}") async deleteBranch(@Path() branchId: string) { - const record = await prisma.branch.findFirst({ where: { id: branchId } }); + const record = await prisma.branch.findFirst({ + include: { + province: true, + district: true, + subDistrict: true, + }, + where: { id: branchId }, + }); if (!record) { throw new HttpError(HttpStatus.NOT_FOUND, "Branch cannot be found.");