diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index f4769367..e1573661 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -10790,7 +10790,7 @@ export class ProfileController extends Controller { setLogDataDiff(request, { before, after: profile }); if (requestBody.isLeave == true) { if(orgRevisionRef){ - await CreatePosMasterHistoryOfficer(orgRevisionRef.id, request); + await CreatePosMasterHistoryOfficer(orgRevisionRef.id, request, "DELETE"); } await removeProfileInOrganize(profile.id, "OFFICER"); } diff --git a/src/middlewares/auth.ts b/src/middlewares/auth.ts index d18c2578..4f2d5438 100644 --- a/src/middlewares/auth.ts +++ b/src/middlewares/auth.ts @@ -34,7 +34,7 @@ export async function expressAuthentication( if (apiKeyHeader === process.env.API_KEY) { return { preferred_username: "api_key_bypass", apiKeyBypass: true }; } else { - return undefined; + throw new HttpError(HttpStatus.FORBIDDEN, "API key ไม่ถูกต้อง"); } } if (process.env.NODE_ENV !== "production" && process.env.AUTH_BYPASS) {