Skip to content

Commit

Permalink
fix: response sent to user
Browse files Browse the repository at this point in the history
  • Loading branch information
masterchief-Dave committed Aug 8, 2024
1 parent 5d208c7 commit 6048600
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/controllers/OrgController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { NextFunction, Request, Response } from "express";
import { ResourceNotFound, ServerError } from "../middleware";
import { OrgService } from "../services/org.services";
import log from "../utils/logger";

Expand Down Expand Up @@ -1080,6 +1081,11 @@ export class OrgController {
organizationId,
roleId,
);

return res.status(200).json({
status_code: 200,
data: response,
});
} catch (error) {
next(error);
}
Expand All @@ -1094,8 +1100,16 @@ export class OrgController {
const organizationId = req.params.org_id;
const response =
await this.orgService.fetchAllRolesInOrganization(organizationId);

return res.status(200).json({
status_code: 200,
data: response,
});
} catch (error) {
next(error);
if (error instanceof ResourceNotFound) {
next(error);
}
next(new ServerError("Error fetching all roles in organization"));
}
}
}

0 comments on commit 6048600

Please sign in to comment.