rhythia-api 190.0.0 → 191.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.
@@ -19,7 +19,6 @@ export const Schema = {
19
19
  misses: z.number().nullable(),
20
20
  mods: z.record(z.unknown()), // JSONB data, can be any object
21
21
  passed: z.boolean().nullable(),
22
- replayHwid: z.string().nullable(),
23
22
  songId: z.string().nullable(),
24
23
  speed: z.number().nullable(),
25
24
  spin: z.boolean(),
@@ -115,7 +114,6 @@ export async function handler(
115
114
  misses: score.misses,
116
115
  mods: score.mods,
117
116
  passed: score.passed,
118
- replayHwid: score.replayhwid,
119
117
  songId: score.songid,
120
118
  speed: score.speed,
121
119
  spin: score.spin,
@@ -19,7 +19,6 @@ export const Schema = {
19
19
  misses: z.number().nullable(),
20
20
  mods: z.record(z.unknown()), // JSONB data, can be any object
21
21
  passed: z.boolean().nullable(),
22
- replayHwid: z.string().nullable(),
23
22
  songId: z.string().nullable(),
24
23
  speed: z.number().nullable(),
25
24
  spin: z.boolean(),
@@ -111,7 +110,6 @@ export async function handler(
111
110
  misses: score.misses,
112
111
  mods: score.mods,
113
112
  passed: score.passed,
114
- replayHwid: score.replayhwid,
115
113
  songId: score.songid,
116
114
  speed: score.speed,
117
115
  spin: score.spin,
@@ -30,6 +30,22 @@ export const Schema = {
30
30
  })
31
31
  )
32
32
  .optional(),
33
+ reign: z
34
+ .array(
35
+ z.object({
36
+ id: z.number(), // Use z.number() for compatibility, or z.bigint() if supported
37
+ awarded_sp: z.number().nullable(), // Use z.number() for NUMERIC
38
+ created_at: z.string(), // Use z.string() for TIMESTAMP WITH TIME ZONE
39
+ misses: z.number().nullable(),
40
+ mods: z.record(z.unknown()),
41
+ passed: z.boolean().nullable(),
42
+ songId: z.string().nullable(),
43
+ speed: z.number().nullable(),
44
+ spin: z.boolean(),
45
+ beatmapHash: z.string().nullable(), // Add beatmapHash to the schema
46
+ })
47
+ )
48
+ .optional(),
33
49
  top: z
34
50
  .array(
35
51
  z.object({
@@ -135,6 +151,15 @@ export async function handler(
135
151
  .slice(0, data.limit)
136
152
  .map((e) => e.score);
137
153
 
154
+ const { data: reignScores, error } = await supabase.rpc(
155
+ "get_user_reigning_scores",
156
+ { userid: data.id }
157
+ );
158
+
159
+ if (error) {
160
+ return NextResponse.json({ error: JSON.stringify(error) });
161
+ }
162
+
138
163
  return NextResponse.json({
139
164
  lastDay: scores1?.map((s) => ({
140
165
  created_at: s.created_at,
@@ -151,6 +176,18 @@ export async function handler(
151
176
  speed: s.speed,
152
177
  spin: s.spin,
153
178
  })),
179
+ reign: reignScores?.map((s) => ({
180
+ id: s.id,
181
+ awarded_sp: s.awarded_sp,
182
+ created_at: s.created_at,
183
+ misses: s.misses,
184
+ mods: s.mods as any,
185
+ passed: s.passed,
186
+ songId: s.songid,
187
+ speed: s.speed,
188
+ spin: s.spin,
189
+ beatmapHash: s.beatmaphash,
190
+ })),
154
191
  top: vals?.map((s) => ({
155
192
  created_at: s.created_at,
156
193
  id: s.id,
package/index.ts CHANGED
@@ -353,7 +353,6 @@ export const Schema = {
353
353
  misses: z.number().nullable(),
354
354
  mods: z.record(z.unknown()), // JSONB data, can be any object
355
355
  passed: z.boolean().nullable(),
356
- replayHwid: z.string().nullable(),
357
356
  songId: z.string().nullable(),
358
357
  speed: z.number().nullable(),
359
358
  spin: z.boolean(),
@@ -412,7 +411,6 @@ export const Schema = {
412
411
  misses: z.number().nullable(),
413
412
  mods: z.record(z.unknown()), // JSONB data, can be any object
414
413
  passed: z.boolean().nullable(),
415
- replayHwid: z.string().nullable(),
416
414
  songId: z.string().nullable(),
417
415
  speed: z.number().nullable(),
418
416
  spin: z.boolean(),
@@ -956,6 +954,22 @@ export const Schema = {
956
954
  })
957
955
  )
958
956
  .optional(),
957
+ reign: z
958
+ .array(
959
+ z.object({
960
+ id: z.number(), // Use z.number() for compatibility, or z.bigint() if supported
961
+ awarded_sp: z.number().nullable(), // Use z.number() for NUMERIC
962
+ created_at: z.string(), // Use z.string() for TIMESTAMP WITH TIME ZONE
963
+ misses: z.number().nullable(),
964
+ mods: z.record(z.unknown()),
965
+ passed: z.boolean().nullable(),
966
+ songId: z.string().nullable(),
967
+ speed: z.number().nullable(),
968
+ spin: z.boolean(),
969
+ beatmapHash: z.string().nullable(), // Add beatmapHash to the schema
970
+ })
971
+ )
972
+ .optional(),
959
973
  top: z
960
974
  .array(
961
975
  z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "190.0.0",
3
+ "version": "191.0.0",
4
4
  "main": "index.ts",
5
5
  "author": "online-contributors",
6
6
  "scripts": {
package/types/database.ts CHANGED
@@ -754,6 +754,24 @@ export type Database = {
754
754
  avatar_url: string
755
755
  }[]
756
756
  }
757
+ get_user_reigning_scores: {
758
+ Args: {
759
+ userid: number
760
+ }
761
+ Returns: {
762
+ id: number
763
+ awarded_sp: number
764
+ created_at: string
765
+ misses: number
766
+ mods: Json
767
+ passed: boolean
768
+ replayhwid: string
769
+ songid: string
770
+ speed: number
771
+ spin: boolean
772
+ beatmaphash: string
773
+ }[]
774
+ }
757
775
  }
758
776
  Enums: {
759
777
  banTypes: "cool" | "silenced" | "restricted" | "excluded"