We need to implement pagination when the user loads posts. We'll implement lazy loading on the frontend in https://github.com/FightPandemics/FightPandemics/issues/127
@robinv85 thinks this might be best handled using mongo "skip" and "limit" parameters https://fightpandemics.slack.com/archives/C010V0DDHLN/p1586966620489600?thread_ts=1586966336.487500&cid=C010V0DDHLN
Let's shoot for loading 5 posts at a time
Check out backend/lib/endpoints/schema/posts.js:
const getPostsSchema = {
querystring: S.object()
.prop("authorId", S.string())
.prop("skip", S.integer())
.prop("limit", S.integer()),
};
I can help with this.
Yeah it seems like there is a large branch of work in progress with updated data model for the mongoose schema's and backend code, possibly including endpoints and API schema''s... I am not sure about current status and progress, but I think @Naraujo13 mentioned that he would like to implement a reusable function that would allow something like using page, limit parameters or similar instead of the mongo skip, limit params... (maybe we can use something standardized like JSON:API)
Damn. Already implemented it for projects API and created a PR :)
@robinv85 @Naraujo13 Any suggestions on how to organize our work?
@mushketyk yeah I didn't know there was so many work in progress without clear indication of status on the Github issue tracker and I've asked @Naraujo13 to split up the branch that they're working on in multiple parts so it's easier to digest in reviews and also to put tickets in progress and assign them where needed, because indeed we need to make sure we can collaborate with more people that want to help out... I think there are currently some PR's open that are related changes so we will have to try to review and merge them one by one asap... my authentication / authorization branch is pretty much finished but the configuration on Auth0 still needs some work for the rules scripts...
@mushketyk just reviewed your PR, left some comments there. Thank you for taking the initiative and trying to help.
As @robinv85 said, I am currently migrating the data models, though not on that arbitrary monolithic way. To avoid that, we're modulating it as a single model change at a time, swapping the mongoose model, and adapting the endpoints that use it(field names and etc), but not adding any extra functionality such as pagination or filters. I'm currently finishing the posts migration at data-model/posts-v2, so no problem with you working on the pagination.
Thank you for the comments @Naraujo13. All make sense. I'll try to update the PR today.
Is this issue linked to: https://github.com/FightPandemics/FightPandemics/issues/127? @robinv85 @silenceway @Naraujo13
@manualzuru yes pagination in the API is what is used to do the lazy loading in the frontend... so if this is already implemented we can close this ticket (cc @Naraujo13 )
I thought based on our discussion at #197 that @mushketyk was doing this so I didn't add that on the posts backend, but if he is not working at it anymore I can add it.