Skip to content

Commit

Permalink
🐛 fix: unable to accept/deny whitelisted units (closes #536)
Browse files Browse the repository at this point in the history
  • Loading branch information
casperiv0 committed Mar 17, 2022
1 parent 4ce7b63 commit c7399b1
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
}

Expand Down

0 comments on commit c7399b1

Please sign in to comment.