feat: add headoffice as relation

This commit is contained in:
Methapon Metanipat 2024-08-30 11:33:08 +07:00
parent 1f47882e19
commit 7fa99fab8f
2 changed files with 17 additions and 0 deletions

View file

@ -179,6 +179,7 @@ export class BranchController extends Controller {
@Query() zipCode?: string,
@Query() filter?: "head" | "sub",
@Query() headOfficeId?: string,
@Query() includeHead?: boolean,
@Query() tree?: boolean,
@Query() query: string = "",
@Query() page: number = 1,
@ -206,6 +207,15 @@ export class BranchController extends Controller {
district: true,
subDistrict: true,
contact: true,
headOffice: includeHead
? {
include: {
province: true,
district: true,
subDistrict: true,
},
}
: false,
branch: tree
? {
include: {

View file

@ -244,6 +244,13 @@ export class UserBranchController extends Controller {
province: true,
district: true,
subDistrict: true,
headOffice: {
include: {
province: true,
district: true,
subDistrict: true,
},
},
},
},
},