Skip to content
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

new paginated functionality added in GET /tasks #647

Closed

Conversation

ivinayakg
Copy link
Contributor

@ivinayakg ivinayakg commented Jul 31, 2022

tests are yet to be created
API Contract

Copy link
Contributor

@ankushdharkar ankushdharkar left a comment

Choose a reason for hiding this comment

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

I feel we need to cover more test cases here.

models/tasks.js Outdated Show resolved Hide resolved
models/tasks.js Outdated Show resolved Hide resolved
models/tasks.js Outdated Show resolved Hide resolved
test/integration/tasks.test.js Outdated Show resolved Hide resolved
test/integration/tasks.test.js Show resolved Hide resolved
test/integration/tasks.test.js Show resolved Hide resolved
models/tasks.js Outdated
const tasksSnapshot = await tasksModel.get();
const tasksSnapshot = await tasksModel
.orderBy("startedOn", "desc")
.startAfter(lastDoc ? lastDoc.startedOn : "")
Copy link
Contributor

Choose a reason for hiding this comment

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

If lastDoc is undefined (or null), does this call error out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no

const fetchTasks = async (limit, offset) => {
let lastDoc;
if (offset) {
lastDoc = await tasksModel.doc(offset).get();
Copy link
Contributor

Choose a reason for hiding this comment

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

Offset should be a number, but here, it seems to be used as a document_id.

lastDoc = await tasksModel.doc(offset).get();
lastDoc = lastDoc.data();
}
const limitDocuments = Number(limit);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we request any number of documents from Firestore? Should there be an upper limit here?

@ivinayakg ivinayakg self-assigned this Aug 5, 2022
@prakashchoudhary07
Copy link
Contributor

Closing this, as this feature is already implemented (https://github.com/Real-Dev-Squad/website-backend/blob/develop/controllers/tasks.js)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants