Skip to content

Commit

Permalink
fix: add support to fetch onboarding extension by requestedBy field
Browse files Browse the repository at this point in the history
  • Loading branch information
pankajjs committed Jan 2, 2025
1 parent 8101a05 commit b7170b8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions constants/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export const REQUEST_TYPE = {
EXTENSION: "EXTENSION",
TASK: "TASK",
ALL: "ALL",
ONBOARDING: "ONBOARDING"
};

export const REQUEST_LOG_TYPE = {
Expand Down
2 changes: 1 addition & 1 deletion middlewares/validators/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const getRequestsMiddleware = async (req: OooRequestCreateRequest, res: O
id: joi.string().optional(),
type: joi
.string()
.valid(REQUEST_TYPE.OOO, REQUEST_TYPE.EXTENSION, REQUEST_TYPE.TASK, REQUEST_TYPE.ALL)
.valid(REQUEST_TYPE.OOO, REQUEST_TYPE.EXTENSION, REQUEST_TYPE.TASK, REQUEST_TYPE.ALL, REQUEST_TYPE.ONBOARDING)
.optional(),
requestedBy: joi.string().insensitive().optional(),
state: joi
Expand Down
2 changes: 1 addition & 1 deletion models/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export const getRequests = async (query: any) => {

if (requestedBy) {
const requestedByUserId = await getUserId(requestedBy);
requestQuery = requestQuery.where("requestedBy", "==", requestedByUserId);
requestQuery = requestQuery.where("requestedBy", "in", [requestedByUserId, requestedBy]);
}
if (type) {
requestQuery = requestQuery.where("type", "==", type);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/requests.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ describe("/requests OOO", function () {
.end(function (err, res) {
expect(res).to.have.status(400);
expect(res.body.error).to.equal("Bad Request");
expect(res.body.message).to.equal('"type" must be one of [OOO, EXTENSION, TASK, ALL]');
expect(res.body.message).to.equal('"type" must be one of [OOO, EXTENSION, TASK, ALL, ONBOARDING]');
done();
});
});
Expand Down

0 comments on commit b7170b8

Please sign in to comment.