()
| 33 | } |
| 34 | |
| 35 | export async function getTenLatestCreatures() { |
| 36 | try { |
| 37 | const creatures = await db.query.creatures.findMany({ |
| 38 | orderBy: (creatures, { desc }) => desc(creatures.createdAt), |
| 39 | limit: 10, |
| 40 | }); |
| 41 | |
| 42 | return creatures; |
| 43 | } catch (error) { |
| 44 | console.error(error); |
| 45 | throw new Error("Failed to get creatures"); |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | export async function getLeaderboard() { |
| 50 | try { |