feat: add headoffice as relation
This commit is contained in:
parent
1f47882e19
commit
7fa99fab8f
2 changed files with 17 additions and 0 deletions
|
|
@ -179,6 +179,7 @@ export class BranchController extends Controller {
|
||||||
@Query() zipCode?: string,
|
@Query() zipCode?: string,
|
||||||
@Query() filter?: "head" | "sub",
|
@Query() filter?: "head" | "sub",
|
||||||
@Query() headOfficeId?: string,
|
@Query() headOfficeId?: string,
|
||||||
|
@Query() includeHead?: boolean,
|
||||||
@Query() tree?: boolean,
|
@Query() tree?: boolean,
|
||||||
@Query() query: string = "",
|
@Query() query: string = "",
|
||||||
@Query() page: number = 1,
|
@Query() page: number = 1,
|
||||||
|
|
@ -206,6 +207,15 @@ export class BranchController extends Controller {
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
contact: true,
|
contact: true,
|
||||||
|
headOffice: includeHead
|
||||||
|
? {
|
||||||
|
include: {
|
||||||
|
province: true,
|
||||||
|
district: true,
|
||||||
|
subDistrict: true,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: false,
|
||||||
branch: tree
|
branch: tree
|
||||||
? {
|
? {
|
||||||
include: {
|
include: {
|
||||||
|
|
|
||||||
|
|
@ -244,6 +244,13 @@ export class UserBranchController extends Controller {
|
||||||
province: true,
|
province: true,
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
|
headOffice: {
|
||||||
|
include: {
|
||||||
|
province: true,
|
||||||
|
district: true,
|
||||||
|
subDistrict: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue