Skip to content

Commit

Permalink
feat(random-projects): make array length assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
hlolli committed Dec 15, 2024
1 parent 98352fa commit fdaf71b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions functions/src/random_projects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ export const randomProjects = onCall<{ count: number }>(async ({ data }) => {
const projectsCollection = await db
.collection("projects")
.where("public", "==", true)
.orderBy("createdAt", "desc")
.orderBy("created", "desc")
.limit(100)
.get();
projects = projectsCollection.docs.map((doc) => ({
const nextProjects = projectsCollection.docs.map((doc) => ({
...doc.data(),
projectUid: doc.id
}));
if (nextProjects.length > 0) {
projects = nextProjects;
}
log("projectsLength: " + projects.length);
}

Expand Down

0 comments on commit fdaf71b

Please sign in to comment.