diff --git a/src/utils/error.ts b/src/utils/error.ts new file mode 100644 index 0000000..b55c8d3 --- /dev/null +++ b/src/utils/error.ts @@ -0,0 +1,10 @@ +import HttpError from "../interfaces/http-error"; +import HttpStatus from "../interfaces/http-status"; + +export function throwRelationError(name: string) { + throw new HttpError( + HttpStatus.BAD_REQUEST, + `${name} cannot be found.`, + `relation${name.replaceAll(" ", "")}NotFound`, + ); +} diff --git a/src/utils/minio.ts b/src/utils/minio.ts index 4216126..d89b0d2 100644 --- a/src/utils/minio.ts +++ b/src/utils/minio.ts @@ -55,4 +55,10 @@ export const fileLocation = { customer: { img: (customerId: string, name?: string) => `customer/img-${customerId}/${name || ""}`, }, + product: { + img: (productId: string, name?: string) => `product/img-${productId}/${name || ""}`, + }, + service: { + img: (serviceId: string, name?: string) => `service/img-${serviceId}/${name || ""}`, + }, };