clubgamma / club-gamma-backend

This is the official repo for club gamma hacktoberfest backend server.
https://clubgamma.vercel.app
MIT License
0 stars 13 forks source link

Filter support for Leaderboard API #10

Closed Reterics closed 1 week ago

Reterics commented 1 week ago

Changed the leaderboard API to

With this update the Issue 21 in the Frontend needs only minor changes, and will be easier to maintain.

jalaym825 commented 1 week ago

minimum prs filter not working

Reterics commented 1 week ago

The original count: prNumbers implementation needed to be changed to counting the prs.

Since Prisma ORM doesn't support filtering directly by the aggregated count in the findMany function, I applied the filter and pagination after the findMany. I tested and it seems to be working.

Note: The code could be greatly simplified/speeded up if the prs number variable was added to webhook/github.js. (In this case the pagination could be put back intoPrisma, and the API call would be faster, but this is an another optimalization ticket)

jalaym825 commented 1 week ago

The original count: prNumbers implementation needed to be changed to counting the prs.

Since Prisma ORM doesn't support filtering directly by the aggregated count in the findMany function, I applied the filter and pagination after the findMany. I tested and it seems to be working.

Note: The code could be greatly simplified/speeded up if the prs number variable was added to webhook/github.js. (In this case the pagination could be put back intoPrisma, and the API call would be faster, but this is an another optimalization ticket)

agree, create a separate issue then.