rhythia-api 77.0.0 → 78.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/api/getProfile.ts CHANGED
@@ -26,6 +26,7 @@ export const Schema = {
26
26
  skill_points: z.number().nullable(),
27
27
  squares_hit: z.number().nullable(),
28
28
  total_score: z.number().nullable(),
29
+ position: z.number().nullable(),
29
30
  })
30
31
  .optional(),
31
32
  }),
@@ -87,9 +88,17 @@ export async function handler(
87
88
  }
88
89
 
89
90
  const user = profiles[0];
91
+
92
+ // Query to count how many players have more skill points than the specific player
93
+ const { count: playersWithMorePoints, error: rankError } = await supabase
94
+ .from("profiles")
95
+ .select("*", { count: "exact", head: true })
96
+ .gt("skill_points", user.skill_points);
97
+
90
98
  return NextResponse.json({
91
99
  user: {
92
100
  ...user,
101
+ position: (playersWithMorePoints || 0) + 1,
93
102
  },
94
103
  });
95
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "77.0.0",
3
+ "version": "78.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun ./scripts/update.ts",