Skip to content

fix: remove jobIds from query #310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

eisbilir
Copy link
Member

@eisbilir eisbilir commented Jun 6, 2021

After header links for pagination added it returns 502 error if jobIds array has more than ~40 ids.
Especially when all of the first,next and last links are exist.
Postman 2021-06-06 19 59 05

when we make page=2, the prev-page link added to the header

Postman 2021-06-06 19 56 34

@eisbilir eisbilir requested a review from LieutenantRoger June 6, 2021 17:02
Comment on lines 61 to +66
req.query.jobIds = req.body.jobIds
}
const result = await service.searchJobs(req.authUser, req.query)
if (req.query.jobIds) {
delete req.query.jobIds
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current logic to add and then to delete fields is a bit hard to follow. It would be nice if logic would more straightforward, for example like this:

const query = {
   ...req.query,
   // we can pass jobIds in `body` or in `query`
   jobIds: _.get(req, 'body.jobIds', req.query.jobIds)
}
const result = await service.searchJobs(req.authUser, query)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, maybe simply check body for it, if jobIds are not present, we can avoid to pass jobIds to the criteria or pass an empty array. By looking at the service method, seems both would be fine.

@eisbilir
Copy link
Member Author

eisbilir commented Jun 7, 2021

fixed by #315

@eisbilir eisbilir deleted the fix-jobIds branch June 10, 2021 15:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants