diff --git a/packages/api/src/controllers/admin/manage/Units.ts b/packages/api/src/controllers/admin/manage/AdminManageUnitsController.ts similarity index 97% rename from packages/api/src/controllers/admin/manage/Units.ts rename to packages/api/src/controllers/admin/manage/AdminManageUnitsController.ts index 2e4178fec..5378fa084 100644 --- a/packages/api/src/controllers/admin/manage/Units.ts +++ b/packages/api/src/controllers/admin/manage/AdminManageUnitsController.ts @@ -22,7 +22,7 @@ type Type = typeof TYPES[number]; @UseBeforeEach(IsAuth) @Controller("/admin/manage/units") -export class ManageUnitsController { +export class AdminManageUnitsController { private socket: Socket; constructor(socket: Socket) { this.socket = socket; @@ -175,13 +175,15 @@ export class ManageUnitsController { async acceptOrDeclineUnit( @PathParams("officerId") officerId: string, @BodyParams("action") action: Action | null, - @BodyParams("type") type: Type, + @BodyParams("type") type: Type | null, ) { + console.log({ action, type }); + if (action && !ACTIONS.includes(action)) { throw new ExtendedBadRequest({ action: "Invalid Action" }); } - if (!TYPES.includes(type)) { + if (!type || !TYPES.includes(type)) { throw new BadRequest("invalidType"); }