rhythia-api 154.0.0 → 155.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.
@@ -29,6 +29,23 @@ export const Schema = {
29
29
  status: z.string().nullable().optional(),
30
30
  })
31
31
  ),
32
+ topUsers: z.array(
33
+ z.object({
34
+ username: z.string(),
35
+ id: z.number(),
36
+ avatar_url: z.string(),
37
+ skill_points: z.number(),
38
+ })
39
+ ),
40
+ lastComments: z.array(
41
+ z.object({
42
+ owner: z.number(),
43
+ content: z.string(),
44
+ username: z.string(),
45
+ beatmapTitle: z.string(),
46
+ beatmapPage: z.number(),
47
+ })
48
+ ),
32
49
  }),
33
50
  };
34
51
 
@@ -77,6 +94,28 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
77
94
  .order("created_at", { ascending: false })
78
95
  .limit(4);
79
96
 
97
+ let { data: topUsers } = await supabase
98
+ .from("profiles")
99
+ .select("*")
100
+ .neq("ban", "excluded")
101
+ .order("skill_points", { ascending: false })
102
+ .limit(3);
103
+
104
+ let { data: comments } = await supabase
105
+ .from("beatmapPageComments")
106
+ .select(
107
+ `
108
+ *,
109
+ beatmapPages!inner(
110
+ *
111
+ ),
112
+ profiles!inner(
113
+ username
114
+ )`
115
+ )
116
+ .order("created_at", { ascending: false })
117
+ .limit(5);
118
+
80
119
  const countScoresQuery = await supabase
81
120
  .from("scores")
82
121
  .select("*", { count: "exact", head: true });
@@ -103,5 +142,18 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
103
142
  status: e.status,
104
143
  nominations: e.nominations as number[],
105
144
  })),
145
+ topUsers: topUsers?.map((e) => ({
146
+ username: e.username,
147
+ id: e.id,
148
+ avatar_url: e.avatar_url,
149
+ skill_points: e.skill_points,
150
+ })),
151
+ lastComments: comments?.map((e) => ({
152
+ owner: e.owner,
153
+ content: e.content,
154
+ username: e.profiles.username,
155
+ beatmapTitle: e.beatmapPages.title,
156
+ beatmapPage: e.beatmapPages.id,
157
+ })),
106
158
  });
107
159
  }
package/index.ts CHANGED
@@ -438,6 +438,23 @@ export const Schema = {
438
438
  status: z.string().nullable().optional(),
439
439
  })
440
440
  ),
441
+ topUsers: z.array(
442
+ z.object({
443
+ username: z.string(),
444
+ id: z.number(),
445
+ avatar_url: z.string(),
446
+ skill_points: z.number(),
447
+ })
448
+ ),
449
+ lastComments: z.array(
450
+ z.object({
451
+ owner: z.number(),
452
+ content: z.string(),
453
+ username: z.string(),
454
+ beatmapTitle: z.string(),
455
+ beatmapPage: z.number(),
456
+ })
457
+ ),
441
458
  }),
442
459
  };*/
443
460
  import { Schema as GetPublicStats } from "./api/getPublicStats"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "154.0.0",
3
+ "version": "155.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun ./scripts/update.ts",