rhythia-api 190.0.0 → 192.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,24 @@ 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
+ beatmapTitle: z.string().nullable(),
47
+ difficulty: z.number().nullable(),
48
+ })
49
+ )
50
+ .optional(),
33
51
  top: z
34
52
  .array(
35
53
  z.object({
@@ -135,6 +153,15 @@ export async function handler(
135
153
  .slice(0, data.limit)
136
154
  .map((e) => e.score);
137
155
 
156
+ const { data: reignScores, error } = await supabase.rpc(
157
+ "get_user_reigning_scores",
158
+ { userid: data.id, page_size: 10 }
159
+ );
160
+
161
+ if (error) {
162
+ return NextResponse.json({ error: JSON.stringify(error) });
163
+ }
164
+
138
165
  return NextResponse.json({
139
166
  lastDay: scores1?.map((s) => ({
140
167
  created_at: s.created_at,
@@ -151,6 +178,20 @@ export async function handler(
151
178
  speed: s.speed,
152
179
  spin: s.spin,
153
180
  })),
181
+ reign: reignScores?.map((s) => ({
182
+ id: s.id,
183
+ awarded_sp: s.awarded_sp,
184
+ created_at: s.created_at,
185
+ misses: s.misses,
186
+ mods: s.mods as any,
187
+ passed: s.passed,
188
+ songId: s.songid,
189
+ speed: s.speed,
190
+ spin: s.spin,
191
+ beatmapHash: s.beatmaphash,
192
+ beatmapTitle: s.beatmaptitle,
193
+ difficulty: s.difficulty,
194
+ })),
154
195
  top: vals?.map((s) => ({
155
196
  created_at: s.created_at,
156
197
  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,24 @@ 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
+ beatmapTitle: z.string().nullable(),
971
+ difficulty: z.number().nullable(),
972
+ })
973
+ )
974
+ .optional(),
959
975
  top: z
960
976
  .array(
961
977
  z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "190.0.0",
3
+ "version": "192.0.0",
4
4
  "main": "index.ts",
5
5
  "author": "online-contributors",
6
6
  "scripts": {
package/types/database.ts CHANGED
@@ -754,6 +754,46 @@ export type Database = {
754
754
  avatar_url: string
755
755
  }[]
756
756
  }
757
+ get_user_reigning_scores:
758
+ | {
759
+ Args: {
760
+ userid: number
761
+ }
762
+ Returns: {
763
+ id: number
764
+ awarded_sp: number
765
+ created_at: string
766
+ misses: number
767
+ mods: Json
768
+ passed: boolean
769
+ replayhwid: string
770
+ songid: string
771
+ speed: number
772
+ spin: boolean
773
+ beatmaphash: string
774
+ }[]
775
+ }
776
+ | {
777
+ Args: {
778
+ userid: number
779
+ page_size: number
780
+ }
781
+ Returns: {
782
+ id: number
783
+ awarded_sp: number
784
+ created_at: string
785
+ misses: number
786
+ mods: Json
787
+ passed: boolean
788
+ replayhwid: string
789
+ songid: string
790
+ speed: number
791
+ spin: boolean
792
+ beatmaphash: string
793
+ beatmaptitle: string
794
+ difficulty: number
795
+ }[]
796
+ }
757
797
  }
758
798
  Enums: {
759
799
  banTypes: "cool" | "silenced" | "restricted" | "excluded"