Skip to content

Commit

Permalink
Merge pull request #2085 from Real-Dev-Squad/fix/sorting-issue-missin…
Browse files Browse the repository at this point in the history
…g-created-field

Fix Sorting Issue in Applications Collection Due to Missing created Field
  • Loading branch information
ankushdharkar authored Aug 20, 2024
2 parents 389cabd + 6a254a7 commit 828793b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions models/applications.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ const getAllApplications = async (limit: number, lastDocId?: string) => {
if (lastDocId) {
lastDoc = await ApplicationsModel.doc(lastDocId).get();
}

let dbQuery = ApplicationsModel.orderBy("createdAt", "desc");
// Hot-fix: Sorting by userId due to missing created field in some entries.
// Revert to createdAt once the field is updated.
// https://github.com/Real-Dev-Squad/website-backend/issues/2084
let dbQuery = ApplicationsModel.orderBy("userId", "desc");

if (lastDoc) {
dbQuery = dbQuery.startAfter(lastDoc);
Expand Down Expand Up @@ -114,7 +116,10 @@ const getApplicationsBasedOnStatus = async (status: string, limit: number, lastD
lastDoc = await ApplicationsModel.doc(lastDocId).get();
}

dbQuery = dbQuery.orderBy("createdAt", "desc");
// Hot-fix: Sorting by userId due to missing created field in some entries.
// Revert to createdAt once the field is updated.
// https://github.com/Real-Dev-Squad/website-backend/issues/2084
dbQuery = dbQuery.orderBy("userId", "desc");

if (lastDoc) {
dbQuery = dbQuery.startAfter(lastDoc);
Expand Down

0 comments on commit 828793b

Please sign in to comment.