refactor: relation
This commit is contained in:
parent
5ccd8909d5
commit
e3464c4891
1 changed files with 4 additions and 6 deletions
|
|
@ -128,15 +128,13 @@ export class ProductGroup extends Controller {
|
||||||
@Security("keycloak")
|
@Security("keycloak")
|
||||||
async getProductGroupById(@Path() groupId: string) {
|
async getProductGroupById(@Path() groupId: string) {
|
||||||
const record = await prisma.productGroup.findFirst({
|
const record = await prisma.productGroup.findFirst({
|
||||||
|
include: {
|
||||||
|
registeredBranch: true,
|
||||||
|
},
|
||||||
where: { id: groupId },
|
where: { id: groupId },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!record)
|
if (!record) throw notFoundError("Product Group");
|
||||||
throw new HttpError(
|
|
||||||
HttpStatus.NOT_FOUND,
|
|
||||||
"Product group cannot be found.",
|
|
||||||
"productGroupNotFound",
|
|
||||||
);
|
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue