rhythia-api 163.0.0 → 164.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
@@ -109,21 +109,21 @@ export async function handler(
109
109
  profiles = queryData;
110
110
  }
111
111
  }
112
-
113
- const { data: activityData } = await supabase
114
- .from("profileActivities")
115
- .select("*")
116
- .eq("uid", user.id)
117
- .single();
118
-
119
- //last 30 minutes
120
- if (activityData && activityData.last_activity) {
121
- isOnline = Date.now() - activityData.last_activity < 1800000;
122
- }
123
112
  }
124
113
 
125
114
  const user = profiles[0];
126
115
 
116
+ const { data: activityData } = await supabase
117
+ .from("profileActivities")
118
+ .select("*")
119
+ .eq("uid", user.uid || "")
120
+ .single();
121
+
122
+ //last 30 minutes
123
+ if (activityData && activityData.last_activity) {
124
+ isOnline = Date.now() - activityData.last_activity < 1800000;
125
+ }
126
+
127
127
  // Query to count how many players have more skill points than the specific player
128
128
  const { count: playersWithMorePoints, error: rankError } = await supabase
129
129
  .from("profiles")
@@ -50,6 +50,12 @@ export const Schema = {
50
50
  })
51
51
  )
52
52
  .optional(),
53
+ stats: z
54
+ .object({
55
+ totalScores: z.number(),
56
+ spinScores: z.number(),
57
+ })
58
+ .optional(),
53
59
  }),
54
60
  };
55
61
 
@@ -105,13 +111,19 @@ export async function handler(
105
111
 
106
112
  if (scores2 == null) return NextResponse.json({ error: "No scores" });
107
113
 
114
+ let spinScores = 0;
115
+ let totalScores = scores2.length;
108
116
  let hashMap: Record<string, { awarded_sp: number; score: any }> = {};
109
117
 
110
118
  for (const score of scores2) {
111
- const { beatmapHash, awarded_sp } = score;
119
+ const { beatmapHash, awarded_sp, spin } = score;
112
120
 
113
121
  if (!beatmapHash || !awarded_sp) continue;
114
122
 
123
+ if (score.spin) {
124
+ spinScores++;
125
+ }
126
+
115
127
  if (!hashMap[beatmapHash] || hashMap[beatmapHash].awarded_sp < awarded_sp) {
116
128
  hashMap[beatmapHash] = { awarded_sp, score };
117
129
  }
@@ -155,5 +167,9 @@ export async function handler(
155
167
  speed: s.speed,
156
168
  spin: s.spin,
157
169
  })),
170
+ stats: {
171
+ totalScores,
172
+ spinScores,
173
+ },
158
174
  });
159
175
  }
package/index.ts CHANGED
@@ -583,6 +583,12 @@ export const Schema = {
583
583
  })
584
584
  )
585
585
  .optional(),
586
+ stats: z
587
+ .object({
588
+ totalScores: z.number(),
589
+ spinScores: z.number(),
590
+ })
591
+ .optional(),
586
592
  }),
587
593
  };*/
588
594
  import { Schema as GetUserScores } from "./api/getUserScores"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "163.0.0",
3
+ "version": "164.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun ./scripts/update.ts",