rhythia-api 180.0.0 → 182.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.
@@ -12,6 +12,7 @@ export const Schema = {
12
12
  collection: z.number(),
13
13
  title: z.string(),
14
14
  description: z.string(),
15
+ isList: z.boolean(),
15
16
  }),
16
17
  output: z.object({
17
18
  error: z.string().optional(),
@@ -69,6 +70,7 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
69
70
  id: data.collection,
70
71
  title: data.title,
71
72
  description: data.description,
73
+ is_list: data.isList,
72
74
  owner: queryUserData.id,
73
75
  });
74
76
  return NextResponse.json({});
@@ -16,6 +16,7 @@ export const Schema = {
16
16
  id: z.number(),
17
17
  username: z.string(),
18
18
  }),
19
+ isList: z.boolean(),
19
20
  beatmaps: z.array(
20
21
  z.object({
21
22
  id: z.number(),
@@ -120,6 +121,7 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
120
121
  username: queryCollectionData.profiles.username,
121
122
  id: queryCollectionData.profiles.id,
122
123
  },
124
+ isList: queryCollectionData.is_list,
123
125
  title: queryCollectionData.title,
124
126
  description: queryCollectionData.description,
125
127
  beatmaps: formattedBeatmaps,
@@ -15,6 +15,9 @@ export const Schema = {
15
15
  id: z.number(),
16
16
  title: z.string(),
17
17
  description: z.string(),
18
+ owner: z.number(),
19
+ ownerUsername: z.string(),
20
+ ownerAvatarUrl: z.string(),
18
21
  beatmapCount: z.number(),
19
22
  starRatingDistribution: z.array(
20
23
  z.object({
@@ -41,7 +44,7 @@ export async function POST(request: Request) {
41
44
 
42
45
  export async function handler(data: (typeof Schema)["input"]["_type"]) {
43
46
  const { data: collections, error } = await supabase
44
- .rpc("get_collections_v1", {
47
+ .rpc("get_collections_v2", {
45
48
  page_number: data.page,
46
49
  items_per_page: data.itemsPerPage,
47
50
  })
@@ -51,6 +54,9 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
51
54
  title: string;
52
55
  description: string;
53
56
  created_at: string;
57
+ owner: number;
58
+ owner_username: string;
59
+ owner_avatar_url: string;
54
60
  beatmap_count: number;
55
61
  star1: number;
56
62
  star2: number;
@@ -62,12 +68,20 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
62
68
  star8: number;
63
69
  star9: number;
64
70
  star10: number;
71
+ star11: number;
72
+ star12: number;
73
+ star13: number;
74
+ star14: number;
75
+ star15: number;
76
+ star16: number;
77
+ star17: number;
78
+ star18: number;
65
79
  total_pages: number;
66
80
  }[]
67
81
  >();
68
82
 
69
83
  if (error) {
70
- return NextResponse.json({ error: "Error fetching collections" });
84
+ return NextResponse.json({ error });
71
85
  }
72
86
 
73
87
  // Get the total pages from the first row (all rows will have the same value)
@@ -78,6 +92,9 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
78
92
  id: collection.id,
79
93
  title: collection.title,
80
94
  description: collection.description,
95
+ owner: collection.owner,
96
+ ownerUsername: collection.owner_username,
97
+ ownerAvatarUrl: collection.owner_avatar_url,
81
98
  beatmapCount: collection.beatmap_count,
82
99
  starRatingDistribution: [
83
100
  { stars: 1, count: collection.star1 },
@@ -90,6 +107,14 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
90
107
  { stars: 8, count: collection.star8 },
91
108
  { stars: 9, count: collection.star9 },
92
109
  { stars: 10, count: collection.star10 },
110
+ { stars: 11, count: collection.star11 },
111
+ { stars: 12, count: collection.star12 },
112
+ { stars: 13, count: collection.star13 },
113
+ { stars: 14, count: collection.star14 },
114
+ { stars: 15, count: collection.star15 },
115
+ { stars: 16, count: collection.star16 },
116
+ { stars: 17, count: collection.star17 },
117
+ { stars: 18, count: collection.star18 },
93
118
  ],
94
119
  createdAt: collection.created_at,
95
120
  })) || [];
@@ -135,7 +135,7 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
135
135
 
136
136
  const countChart = await supabase
137
137
  .from("chartedValues")
138
- .select("*")
138
+ .select("value")
139
139
  .eq("type", "online_players")
140
140
  .gt("created_at", new Date(Date.now() - 86400000).toISOString());
141
141
 
package/index.ts CHANGED
@@ -208,6 +208,7 @@ export const Schema = {
208
208
  collection: z.number(),
209
209
  title: z.string(),
210
210
  description: z.string(),
211
+ isList: z.boolean(),
211
212
  }),
212
213
  output: z.object({
213
214
  error: z.string().optional(),
@@ -515,6 +516,7 @@ export const Schema = {
515
516
  id: z.number(),
516
517
  username: z.string(),
517
518
  }),
519
+ isList: z.boolean(),
518
520
  beatmaps: z.array(
519
521
  z.object({
520
522
  id: z.number(),
@@ -556,6 +558,9 @@ export const Schema = {
556
558
  id: z.number(),
557
559
  title: z.string(),
558
560
  description: z.string(),
561
+ owner: z.number(),
562
+ ownerUsername: z.string(),
563
+ ownerAvatarUrl: z.string(),
559
564
  beatmapCount: z.number(),
560
565
  starRatingDistribution: z.array(
561
566
  z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "180.0.0",
3
+ "version": "182.0.0",
4
4
  "main": "index.ts",
5
5
  "author": "online-contributors",
6
6
  "scripts": {
package/types/database.ts CHANGED
@@ -14,6 +14,7 @@ export type Database = {
14
14
  created_at: string
15
15
  description: string
16
16
  id: number
17
+ is_list: boolean
17
18
  owner: number
18
19
  title: string
19
20
  }
@@ -21,6 +22,7 @@ export type Database = {
21
22
  created_at?: string
22
23
  description: string
23
24
  id?: number
25
+ is_list?: boolean
24
26
  owner: number
25
27
  title: string
26
28
  }
@@ -28,6 +30,7 @@ export type Database = {
28
30
  created_at?: string
29
31
  description?: string
30
32
  id?: number
33
+ is_list?: boolean
31
34
  owner?: number
32
35
  title?: string
33
36
  }
@@ -515,6 +518,42 @@ export type Database = {
515
518
  title: string
516
519
  description: string
517
520
  created_at: string
521
+ owner: number
522
+ beatmap_count: number
523
+ star1: number
524
+ star2: number
525
+ star3: number
526
+ star4: number
527
+ star5: number
528
+ star6: number
529
+ star7: number
530
+ star8: number
531
+ star9: number
532
+ star10: number
533
+ star11: number
534
+ star12: number
535
+ star13: number
536
+ star14: number
537
+ star15: number
538
+ star16: number
539
+ star17: number
540
+ star18: number
541
+ total_pages: number
542
+ }[]
543
+ }
544
+ get_collections_v2: {
545
+ Args: {
546
+ page_number?: number
547
+ items_per_page?: number
548
+ }
549
+ Returns: {
550
+ id: number
551
+ title: string
552
+ description: string
553
+ created_at: string
554
+ owner: number
555
+ owner_username: string
556
+ owner_avatar_url: string
518
557
  beatmap_count: number
519
558
  star1: number
520
559
  star2: number
@@ -526,6 +565,14 @@ export type Database = {
526
565
  star8: number
527
566
  star9: number
528
567
  star10: number
568
+ star11: number
569
+ star12: number
570
+ star13: number
571
+ star14: number
572
+ star15: number
573
+ star16: number
574
+ star17: number
575
+ star18: number
529
576
  total_pages: number
530
577
  }[]
531
578
  }