rhythia-api 94.0.0 → 96.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.
@@ -24,10 +24,30 @@ export const Schema = {
24
24
  rank: z.string().nullable(),
25
25
  songId: z.string().nullable(),
26
26
  userId: z.number().nullable(),
27
+ beatmapDifficulty: z.number().optional().nullable(),
28
+ beatmapNotes: z.number().optional().nullable(),
29
+ beatmapTitle: z.string().optional().nullable(),
30
+ })
31
+ )
32
+ .optional(),
33
+ top: z
34
+ .array(
35
+ z.object({
36
+ awarded_sp: z.number().nullable(),
37
+ beatmapHash: z.string().nullable(),
38
+ created_at: z.string(),
39
+ id: z.number(),
40
+ misses: z.number().nullable(),
41
+ passed: z.boolean().nullable(),
42
+ rank: z.string().nullable(),
43
+ songId: z.string().nullable(),
44
+ userId: z.number().nullable(),
45
+ beatmapDifficulty: z.number().optional().nullable(),
46
+ beatmapNotes: z.number().optional().nullable(),
47
+ beatmapTitle: z.string().optional().nullable(),
27
48
  })
28
49
  )
29
50
  .optional(),
30
- top: z.array(z.object({})).optional(),
31
51
  }),
32
52
  };
33
53
 
@@ -46,15 +66,34 @@ export async function handler(
46
66
  ): Promise<NextResponse<(typeof Schema)["output"]["_type"]>> {
47
67
  let { data: scores1, error: errorlast } = await supabase
48
68
  .from("scores")
49
- .select("*")
69
+ .select(
70
+ `
71
+ *,
72
+ beatmaps (
73
+ difficulty,
74
+ noteCount,
75
+ title
76
+ )
77
+ `
78
+ )
50
79
  .eq("userId", data.id)
51
80
  .order("created_at", { ascending: false })
52
81
  .limit(10);
53
82
 
54
83
  let { data: scores2, error: errorsp } = await supabase
55
84
  .from("scores")
56
- .select("*")
85
+ .select(
86
+ `
87
+ *,
88
+ beatmaps (
89
+ difficulty,
90
+ noteCount,
91
+ title
92
+ )
93
+ `
94
+ )
57
95
  .eq("userId", data.id)
96
+ .neq("awarded_sp", 0)
58
97
  .order("awarded_sp", { ascending: false })
59
98
  .limit(10);
60
99
 
@@ -69,6 +108,9 @@ export async function handler(
69
108
  misses: s.misses,
70
109
  rank: s.rank,
71
110
  songId: s.songId,
111
+ beatmapDifficulty: s.beatmaps?.difficulty,
112
+ beatmapNotes: s.beatmaps?.noteCount,
113
+ beatmapTitle: s.beatmaps?.title,
72
114
  })),
73
115
  top: scores2?.map((s) => ({
74
116
  created_at: s.created_at,
@@ -80,6 +122,9 @@ export async function handler(
80
122
  misses: s.misses,
81
123
  rank: s.rank,
82
124
  songId: s.songId,
125
+ beatmapDifficulty: s.beatmaps?.difficulty,
126
+ beatmapNotes: s.beatmaps?.noteCount,
127
+ beatmapTitle: s.beatmaps?.title,
83
128
  })),
84
129
  });
85
130
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "94.0.0",
3
+ "version": "96.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun ./scripts/update.ts",