feat: add query param to include user branch
This commit is contained in:
parent
7e6325d359
commit
ae42cb2f76
1 changed files with 3 additions and 0 deletions
|
|
@ -133,6 +133,7 @@ export class UserController extends Controller {
|
|||
async getUser(
|
||||
@Query() userType?: UserType,
|
||||
@Query() zipCode?: string,
|
||||
@Query() includeBranch: boolean = false,
|
||||
@Query() query: string = "",
|
||||
@Query() page: number = 1,
|
||||
@Query() pageSize: number = 30,
|
||||
|
|
@ -155,6 +156,7 @@ export class UserController extends Controller {
|
|||
province: true,
|
||||
district: true,
|
||||
subDistrict: true,
|
||||
branch: { include: { branch: includeBranch } },
|
||||
},
|
||||
where,
|
||||
take: pageSize,
|
||||
|
|
@ -167,6 +169,7 @@ export class UserController extends Controller {
|
|||
result: await Promise.all(
|
||||
result.map(async (v) => ({
|
||||
...v,
|
||||
branch: includeBranch ? v.branch.map((a) => a.branch) : undefined,
|
||||
profileImageUrl: await minio.presignedGetObject(
|
||||
MINIO_BUCKET,
|
||||
imageLocation(v.id),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue