fix: permission & user code
This commit is contained in:
parent
d8a6565abe
commit
1048944773
2 changed files with 22 additions and 22 deletions
|
|
@ -210,7 +210,7 @@ export class UserController extends Controller {
|
|||
});
|
||||
|
||||
if (!record)
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "userNotFound");
|
||||
|
||||
return Object.assign(record, {
|
||||
profileImageUrl: await minio.presignedGetObject(
|
||||
|
|
@ -233,21 +233,21 @@ export class UserController extends Controller {
|
|||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
"Province cannot be found.",
|
||||
"missing_or_invalid_parameter",
|
||||
"relationProvinceNotFound",
|
||||
);
|
||||
}
|
||||
if (body.districtId && !district) {
|
||||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
"District cannot be found.",
|
||||
"missing_or_invalid_parameter",
|
||||
"relationDistrictNotFound",
|
||||
);
|
||||
}
|
||||
if (body.subDistrictId && !subDistrict) {
|
||||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
"Sub-district cannot be found.",
|
||||
"missing_or_invalid_parameter",
|
||||
"relationSubDistrictNotFound",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -396,7 +396,7 @@ export class UserController extends Controller {
|
|||
});
|
||||
|
||||
if (!user) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Branch cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "Branch cannot be found.", "branchNotFound");
|
||||
}
|
||||
|
||||
const lastUserOfType =
|
||||
|
|
@ -463,11 +463,11 @@ export class UserController extends Controller {
|
|||
});
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "userNotFound");
|
||||
}
|
||||
|
||||
if (record.status !== Status.CREATED) {
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "User is in used.", "data_in_used");
|
||||
throw new HttpError(HttpStatus.FORBIDDEN, "User is in used.", "userInUsed");
|
||||
}
|
||||
|
||||
await minio.removeObject(MINIO_BUCKET, imageLocation(userId), {
|
||||
|
|
@ -521,7 +521,7 @@ export class UserAttachmentController extends Controller {
|
|||
});
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "userNotFound");
|
||||
}
|
||||
|
||||
const list = await new Promise<string[]>((resolve, reject) => {
|
||||
|
|
@ -554,7 +554,7 @@ export class UserAttachmentController extends Controller {
|
|||
});
|
||||
|
||||
if (!record) {
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "data_not_found");
|
||||
throw new HttpError(HttpStatus.NOT_FOUND, "User cannot be found.", "userNotFound");
|
||||
}
|
||||
|
||||
return await Promise.all(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue