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.
- package/api/getLeaderboard.ts +1 -0
- package/api/getPublicStats.ts +9 -1
- package/api/postBeatmapComment.ts +1 -0
- package/index.ts +2 -0
- package/package.json +1 -1
package/api/getLeaderboard.ts
CHANGED
package/api/getPublicStats.ts
CHANGED
|
@@ -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("
|
|
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(),
|