feat: get customer branch by id

This commit is contained in:
Methapon2001 2024-04-05 15:09:44 +07:00
parent 620a57c6c6
commit 3f43ad1b9b

View file

@ -121,6 +121,24 @@ export class CustomerBranchController extends Controller {
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")
async listEmployee(
@Path() branchId: string,