()
| 73 | } |
| 74 | |
| 75 | export async function getStarsLeaderboard() { |
| 76 | try { |
| 77 | const creatures = await db.query.creatures.findMany({ |
| 78 | orderBy: (creatures, { desc }) => desc(creatures.stars), |
| 79 | limit: 10, |
| 80 | }); |
| 81 | return creatures; |
| 82 | } catch (error) { |
| 83 | console.error(error); |
| 84 | throw new Error("Failed to get stars leaderboard"); |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | export async function getCreatureTopPercentage(id: string) { |
| 89 | try { |