feat: get customer branch by id
This commit is contained in:
parent
620a57c6c6
commit
3f43ad1b9b
1 changed files with 18 additions and 0 deletions
|
|
@ -121,6 +121,24 @@ export class CustomerBranchController extends Controller {
|
||||||
return { result, page, pageSize, total };
|
return { result, page, pageSize, total };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Get("{branchId}")
|
||||||
|
async getById(@Path() branchId: string) {
|
||||||
|
const record = await prisma.customerBranch.findFirst({
|
||||||
|
include: {
|
||||||
|
province: true,
|
||||||
|
district: true,
|
||||||
|
subDistrict: true,
|
||||||
|
},
|
||||||
|
where: { id: branchId },
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!record) {
|
||||||
|
throw new HttpError(HttpStatus.NOT_FOUND, "Branch cannot be found.", "data_not_found");
|
||||||
|
}
|
||||||
|
|
||||||
|
return record;
|
||||||
|
}
|
||||||
|
|
||||||
@Get("{branchId}/employee")
|
@Get("{branchId}/employee")
|
||||||
async listEmployee(
|
async listEmployee(
|
||||||
@Path() branchId: string,
|
@Path() branchId: string,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue