fix: group code
This commit is contained in:
parent
9722fab149
commit
5dbc261a79
1 changed files with 4 additions and 4 deletions
|
|
@ -56,7 +56,7 @@ export class ProductGroup extends Controller {
|
|||
});
|
||||
|
||||
if (!record)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product group cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product group cannot be found.", "productGroupNotFound");
|
||||
|
||||
return record;
|
||||
}
|
||||
|
|
@ -100,7 +100,7 @@ export class ProductGroup extends Controller {
|
|||
@Path() groupId: string,
|
||||
) {
|
||||
if (!(await prisma.productGroup.findUnique({ where: { id: groupId } }))) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product group cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product group cannot be found.", "productGroupNotFound");
|
||||
}
|
||||
|
||||
const record = await prisma.productGroup.update({
|
||||
|
|
@ -116,11 +116,11 @@ export class ProductGroup extends Controller {
|
|||
const record = await prisma.productGroup.findFirst({ where: { id: groupId } });
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product group cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product group cannot be found.", "productGroupNotFound");
|
||||
}
|
||||
|
||||
if (record.status !== Status.CREATED) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "Product group is in used.", "data_in_used");
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "Product group is in used.", "productGroupInUsed");
|
||||
}
|
||||
|
||||
return await prisma.productGroup.delete({ where: { id: groupId } });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue