fix: work & service code
This commit is contained in:
parent
e7e090ecbd
commit
c978d3adec
2 changed files with 10 additions and 10 deletions
|
|
@ -124,7 +124,7 @@ export class ServiceController extends Controller {
|
|||
});
|
||||
|
||||
if (!record)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Service cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Service cannot be found.", "serviceNotFound");
|
||||
|
||||
return Object.assign(record, {
|
||||
imageUrl: await presignedGetObjectIfExist(MINIO_BUCKET, imageLocation(record.id), 60 * 60),
|
||||
|
|
@ -173,7 +173,7 @@ export class ServiceController extends Controller {
|
|||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
"Some product not found.",
|
||||
"missing_or_invalid_parameter",
|
||||
"someProductBadReq",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +250,7 @@ export class ServiceController extends Controller {
|
|||
@Path() serviceId: string,
|
||||
) {
|
||||
if (!(await prisma.service.findUnique({ where: { id: serviceId } }))) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Service cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Service cannot be found.", "serviceNotFound");
|
||||
}
|
||||
|
||||
const record = await prisma.service.update({
|
||||
|
|
@ -276,11 +276,11 @@ export class ServiceController extends Controller {
|
|||
const record = await prisma.service.findFirst({ where: { id: serviceId } });
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Service cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Service cannot be found.", "serviceNotFound");
|
||||
}
|
||||
|
||||
if (record.status !== Status.CREATED) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "Service is in used.", "data_in_used");
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "Service is in used.", "serviceInUsed");
|
||||
}
|
||||
|
||||
return await prisma.service.delete({ where: { id: serviceId } });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue