rhythia-api 120.0.0 → 121.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/getBeatmaps.ts +6 -11
- package/api/getLeaderboard.ts +1 -1
- package/api/getScore.ts +2 -0
- package/api/getUserScores.ts +4 -0
- package/package.json +2 -2
- package/types/database.ts +3 -0
package/api/getBeatmaps.ts
CHANGED
|
@@ -64,28 +64,26 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
|
|
|
64
64
|
const endPage = startPage + VIEW_PER_PAGE - 1;
|
|
65
65
|
const countQuery = await supabase
|
|
66
66
|
.from("beatmapPages")
|
|
67
|
-
.select("
|
|
67
|
+
.select("id", { count: "exact", head: true });
|
|
68
68
|
|
|
69
69
|
let qry = supabase
|
|
70
70
|
.from("beatmapPages")
|
|
71
71
|
.select(
|
|
72
72
|
`
|
|
73
|
-
|
|
73
|
+
owner,
|
|
74
|
+
created_at,
|
|
75
|
+
id,
|
|
74
76
|
beatmaps!inner(
|
|
75
|
-
created_at,
|
|
76
77
|
playcount,
|
|
77
|
-
length,
|
|
78
78
|
ranked,
|
|
79
79
|
beatmapFile,
|
|
80
80
|
image,
|
|
81
81
|
starRating,
|
|
82
82
|
difficulty,
|
|
83
|
-
noteCount,
|
|
84
83
|
title
|
|
85
84
|
),
|
|
86
85
|
profiles!inner(
|
|
87
|
-
username
|
|
88
|
-
avatar_url
|
|
86
|
+
username
|
|
89
87
|
)`
|
|
90
88
|
)
|
|
91
89
|
.order("created_at", { ascending: false });
|
|
@@ -105,7 +103,7 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
|
|
|
105
103
|
qry = qry.eq("status", data.status);
|
|
106
104
|
}
|
|
107
105
|
|
|
108
|
-
if (data.creator) {
|
|
106
|
+
if (data.creator !== undefined) {
|
|
109
107
|
qry = qry.eq("owner", data.creator);
|
|
110
108
|
}
|
|
111
109
|
|
|
@@ -120,8 +118,6 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
|
|
|
120
118
|
playcount: beatmapPage.beatmaps?.playcount,
|
|
121
119
|
created_at: beatmapPage.created_at,
|
|
122
120
|
difficulty: beatmapPage.beatmaps?.difficulty,
|
|
123
|
-
noteCount: beatmapPage.beatmaps?.noteCount,
|
|
124
|
-
length: beatmapPage.beatmaps?.length,
|
|
125
121
|
title: beatmapPage.beatmaps?.title,
|
|
126
122
|
ranked: beatmapPage.beatmaps?.ranked,
|
|
127
123
|
beatmapFile: beatmapPage.beatmaps?.beatmapFile,
|
|
@@ -129,7 +125,6 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
|
|
|
129
125
|
starRating: beatmapPage.beatmaps?.starRating,
|
|
130
126
|
owner: beatmapPage.owner,
|
|
131
127
|
ownerUsername: beatmapPage.profiles?.username,
|
|
132
|
-
ownerAvatar: beatmapPage.profiles?.avatar_url,
|
|
133
128
|
})),
|
|
134
129
|
};
|
|
135
130
|
}
|
package/api/getLeaderboard.ts
CHANGED
|
@@ -73,7 +73,7 @@ export async function getLeaderboard(page = 1, session: string) {
|
|
|
73
73
|
const endPage = startPage + VIEW_PER_PAGE - 1;
|
|
74
74
|
const countQuery = await supabase
|
|
75
75
|
.from("profiles")
|
|
76
|
-
.select("
|
|
76
|
+
.select("ban", { count: "exact", head: true })
|
|
77
77
|
.neq("ban", "excluded");
|
|
78
78
|
|
|
79
79
|
let { data: queryData, error } = await supabase
|
package/api/getScore.ts
CHANGED
|
@@ -24,6 +24,7 @@ export const Schema = {
|
|
|
24
24
|
beatmapNotes: z.number().optional().nullable(),
|
|
25
25
|
beatmapTitle: z.string().optional().nullable(),
|
|
26
26
|
username: z.string().optional().nullable(),
|
|
27
|
+
speed: z.number().optional().nullable(),
|
|
27
28
|
})
|
|
28
29
|
.optional(),
|
|
29
30
|
}),
|
|
@@ -76,6 +77,7 @@ export async function handler(
|
|
|
76
77
|
beatmapNotes: score.beatmaps?.noteCount,
|
|
77
78
|
beatmapTitle: score.beatmaps?.title,
|
|
78
79
|
username: score.profiles?.username,
|
|
80
|
+
speed: score.speed,
|
|
79
81
|
},
|
|
80
82
|
});
|
|
81
83
|
}
|
package/api/getUserScores.ts
CHANGED
|
@@ -24,6 +24,7 @@ export const Schema = {
|
|
|
24
24
|
beatmapDifficulty: z.number().optional().nullable(),
|
|
25
25
|
beatmapNotes: z.number().optional().nullable(),
|
|
26
26
|
beatmapTitle: z.string().optional().nullable(),
|
|
27
|
+
speed: z.number().optional().nullable(),
|
|
27
28
|
})
|
|
28
29
|
)
|
|
29
30
|
.optional(),
|
|
@@ -42,6 +43,7 @@ export const Schema = {
|
|
|
42
43
|
beatmapDifficulty: z.number().optional().nullable(),
|
|
43
44
|
beatmapNotes: z.number().optional().nullable(),
|
|
44
45
|
beatmapTitle: z.string().optional().nullable(),
|
|
46
|
+
speed: z.number().optional().nullable(),
|
|
45
47
|
})
|
|
46
48
|
)
|
|
47
49
|
.optional(),
|
|
@@ -128,6 +130,7 @@ export async function handler(
|
|
|
128
130
|
beatmapDifficulty: s.beatmaps?.difficulty,
|
|
129
131
|
beatmapNotes: s.beatmaps?.noteCount,
|
|
130
132
|
beatmapTitle: s.beatmaps?.title,
|
|
133
|
+
speed: s.speed,
|
|
131
134
|
})),
|
|
132
135
|
top: vals?.map((s) => ({
|
|
133
136
|
created_at: s.created_at,
|
|
@@ -142,6 +145,7 @@ export async function handler(
|
|
|
142
145
|
beatmapDifficulty: s.beatmaps?.difficulty,
|
|
143
146
|
beatmapNotes: s.beatmaps?.noteCount,
|
|
144
147
|
beatmapTitle: s.beatmaps?.title,
|
|
148
|
+
speed: s.speed,
|
|
145
149
|
})),
|
|
146
150
|
});
|
|
147
151
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rhythia-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "121.0.0",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "bun ./scripts/update.ts",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"osu-parsers": "^4.1.7",
|
|
34
34
|
"osu-standard-stable": "^5.0.0",
|
|
35
35
|
"simple-git": "^3.25.0",
|
|
36
|
-
"supabase": "^1.
|
|
36
|
+
"supabase": "^1.204.3",
|
|
37
37
|
"tsx": "^4.17.0",
|
|
38
38
|
"utf-8-validate": "^6.0.4",
|
|
39
39
|
"zod": "^3.23.8"
|
package/types/database.ts
CHANGED
|
@@ -174,6 +174,7 @@ export type Database = {
|
|
|
174
174
|
passed: boolean | null
|
|
175
175
|
replayHwid: string | null
|
|
176
176
|
songId: string | null
|
|
177
|
+
speed: number | null
|
|
177
178
|
userId: number | null
|
|
178
179
|
}
|
|
179
180
|
Insert: {
|
|
@@ -185,6 +186,7 @@ export type Database = {
|
|
|
185
186
|
passed?: boolean | null
|
|
186
187
|
replayHwid?: string | null
|
|
187
188
|
songId?: string | null
|
|
189
|
+
speed?: number | null
|
|
188
190
|
userId?: number | null
|
|
189
191
|
}
|
|
190
192
|
Update: {
|
|
@@ -196,6 +198,7 @@ export type Database = {
|
|
|
196
198
|
passed?: boolean | null
|
|
197
199
|
replayHwid?: string | null
|
|
198
200
|
songId?: string | null
|
|
201
|
+
speed?: number | null
|
|
199
202
|
userId?: number | null
|
|
200
203
|
}
|
|
201
204
|
Relationships: [
|