rhythia-api 166.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/getPublicStats.ts +9 -1
- package/api/postBeatmapComment.ts +1 -0
- package/index.ts +1 -0
- package/package.json +1 -1
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