rhythia-api 165.0.0 → 167.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.
@@ -26,6 +26,7 @@ export const Schema = {
26
26
  username: z.string().nullable(),
27
27
  play_count: z.number().nullable(),
28
28
  skill_points: z.number().nullable(),
29
+ spin_skill_points: z.number().nullable(),
29
30
  total_score: z.number().nullable(),
30
31
  })
31
32
  )
@@ -9,6 +9,7 @@ export const Schema = {
9
9
  profiles: z.number(),
10
10
  beatmaps: z.number(),
11
11
  scores: z.number(),
12
+ onlineUsers: z.number(),
12
13
  lastBeatmaps: z.array(
13
14
  z.object({
14
15
  id: z.number().nullable().optional(),
@@ -118,12 +119,19 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
118
119
 
119
120
  const countScoresQuery = await supabase
120
121
  .from("scores")
121
- .select("*", { count: "exact", head: true });
122
+ .select("id", { count: "exact", head: true });
123
+
124
+ // 30 minutes activity
125
+ const countOnline = await supabase
126
+ .from("profileActivities")
127
+ .select("*", { count: "exact", head: true })
128
+ .eq("last_activity", Date.now() - 1800000);
122
129
 
123
130
  return NextResponse.json({
124
131
  beatmaps: countBeatmapsQuery.count,
125
132
  profiles: countProfilesQuery.count,
126
133
  scores: countScoresQuery.count,
134
+ onlineUsers: countOnline.count,
127
135
  lastBeatmaps: beatmapPage?.map((e) => ({
128
136
  playcount: e.beatmaps?.playcount,
129
137
  created_at: e.created_at,
@@ -40,6 +40,7 @@ export async function handler({
40
40
  .single();
41
41
 
42
42
  if (!userData) return NextResponse.json({ error: "No user." });
43
+ if (userData.ban !== "cool") return NextResponse.json({ error: "Error" });
43
44
 
44
45
  const upserted = await supabase
45
46
  .from("beatmapPageComments")
package/index.ts CHANGED
@@ -347,6 +347,7 @@ export const Schema = {
347
347
  username: z.string().nullable(),
348
348
  play_count: z.number().nullable(),
349
349
  skill_points: z.number().nullable(),
350
+ spin_skill_points: z.number().nullable(),
350
351
  total_score: z.number().nullable(),
351
352
  })
352
353
  )
@@ -444,6 +445,7 @@ export const Schema = {
444
445
  profiles: z.number(),
445
446
  beatmaps: z.number(),
446
447
  scores: z.number(),
448
+ onlineUsers: z.number(),
447
449
  lastBeatmaps: z.array(
448
450
  z.object({
449
451
  id: z.number().nullable().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "165.0.0",
3
+ "version": "167.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun ./scripts/update.ts",