fix: type code
This commit is contained in:
parent
5fa8b00d4f
commit
e7e090ecbd
1 changed files with 6 additions and 6 deletions
|
|
@ -73,7 +73,7 @@ export class ProductType extends Controller {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!record)
|
if (!record)
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product type cannot be found.", "data_not_found");
|
throw new HttpError(HttpStatus.NOT_FOUND, "Product type cannot be found.", "productTypeNotFound");
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
@ -88,7 +88,7 @@ export class ProductType extends Controller {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatus.BAD_REQUEST,
|
HttpStatus.BAD_REQUEST,
|
||||||
"Product group associated cannot be found.",
|
"Product group associated cannot be found.",
|
||||||
"missing_or_invalid_parameter",
|
"productGroupAssociatedBadReq",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,12 +135,12 @@ export class ProductType extends Controller {
|
||||||
throw new HttpError(
|
throw new HttpError(
|
||||||
HttpStatus.BAD_REQUEST,
|
HttpStatus.BAD_REQUEST,
|
||||||
"Product group cannot be found.",
|
"Product group cannot be found.",
|
||||||
"missing_or_invalid_parameter",
|
"productGroupBadReq",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(await prisma.productType.findUnique({ where: { id: typeId } }))) {
|
if (!(await prisma.productType.findUnique({ where: { id: typeId } }))) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product type cannot be found.", "data_not_found");
|
throw new HttpError(HttpStatus.NOT_FOUND, "Product type cannot be found.", "productTypeNotFound");
|
||||||
}
|
}
|
||||||
|
|
||||||
const record = await prisma.productType.update({
|
const record = await prisma.productType.update({
|
||||||
|
|
@ -156,11 +156,11 @@ export class ProductType extends Controller {
|
||||||
const record = await prisma.productType.findFirst({ where: { id: typeId } });
|
const record = await prisma.productType.findFirst({ where: { id: typeId } });
|
||||||
|
|
||||||
if (!record) {
|
if (!record) {
|
||||||
throw new HttpError(HttpStatus.NOT_FOUND, "Product type cannot be found.", "data_not_found");
|
throw new HttpError(HttpStatus.NOT_FOUND, "Product type cannot be found.", "productTypeNotFound");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (record.status !== Status.CREATED) {
|
if (record.status !== Status.CREATED) {
|
||||||
throw new HttpError(HttpStatus.FORBIDDEN, "Product type is in used.", "data_in_used");
|
throw new HttpError(HttpStatus.FORBIDDEN, "Product type is in used.", "productTypeInUsed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return await prisma.productType.delete({ where: { id: typeId } });
|
return await prisma.productType.delete({ where: { id: typeId } });
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue