-
Notifications
You must be signed in to change notification settings - Fork 9
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
#167190450 Implement pagination for Articles #22
Conversation
15af4ac
to
26d70eb
Compare
26d70eb
to
fab9f9e
Compare
fab9f9e
to
e6e626d
Compare
e6e626d
to
953329e
Compare
953329e
to
e48a1b9
Compare
e48a1b9
to
03718a0
Compare
03718a0
to
c95fe4f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
page = parseInt(page, 10) > 0 ? page : 1; | ||
const offset = (page - 1) * limit; | ||
const articles = await models.Article.findAndCountAll({ | ||
where: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious bro. Is there any reason why you specified an empty where constraint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you very much for that question. The reason is that am not supposed to filter the returned article by any condition. If the story, for instance, required that I paginate the article and return articles that belong to a particular author, then I can include a condition in the where
object. (e.g where: {authorId: req.user.id)
, then this will return only articles created by an author with the specified authorId.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
4aa89c3
to
de421fd
Compare
- setup pagination for articles - write controller functions to handle pagination - write unit test [finishes #167190450]
de421fd
to
c2d8ab9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work. LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
#167190450 Implement pagination for Articles
#167190450 Implement pagination for Articles
What does this PR do?
Description of Task to be completed?
How should this be manually tested?
Any background context you want to provide?
What are the relevant pivotal tracker stories?
#167190450
Screenshots (if appropriate)
Questions: