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.
@@ -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("*", { count: "exact", head: true });
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
@@ -445,6 +445,7 @@ export const Schema = {
445
445
  profiles: z.number(),
446
446
  beatmaps: z.number(),
447
447
  scores: z.number(),
448
+ onlineUsers: z.number(),
448
449
  lastBeatmaps: z.array(
449
450
  z.object({
450
451
  id: z.number().nullable().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "166.0.0",
3
+ "version": "167.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun ./scripts/update.ts",