Skip to content

Commit

Permalink
Add holder ranking based on holder score
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielSintimbrean committed Nov 30, 2023
1 parent e09bb30 commit 8327369
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/schema/holder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ builder.prismaObject("Holder", {
);
},
}),
holderScore: t.expose("holderScore", { type: "BigInt" }),
holderRanking: t.int({
resolve: async (param) => {
const totalHoldersScore = await prisma.holder.aggregate({
_count: {
holderScore: true,
},
where: {
holderScore: {
gt: param.holderScore,
},
},
});

return totalHoldersScore._count.holderScore + 1;
},
}),
mrCryptosOwned: t.relation("MrCryptosOwned", {
args: {
first: t.arg.int({ required: true, defaultValue: 100 }),
Expand Down

0 comments on commit 8327369

Please sign in to comment.