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")
|
||||
async getProductGroupById(@Path() groupId: string) {
|
||||
const record = await prisma.productGroup.findFirst({
|
||||
include: {
|
||||
registeredBranch: true,
|
||||
},
|
||||
where: { id: groupId },
|
||||
});
|
||||
|
||||
if (!record)
|
||||
throw new HttpError(
|
||||
HttpStatus.NOT_FOUND,
|
||||
"Product group cannot be found.",
|
||||
"productGroupNotFound",
|
||||
);
|
||||
if (!record) throw notFoundError("Product Group");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue