rhythia-api 179.0.0 → 180.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.
@@ -59,6 +59,12 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
59
59
  });
60
60
  }
61
61
 
62
+ if (data.description.length > 128) {
63
+ return NextResponse.json({
64
+ error: "Description too long",
65
+ });
66
+ }
67
+
62
68
  await supabase.from("beatmapCollections").upsert({
63
69
  id: data.collection,
64
70
  title: data.title,
@@ -12,6 +12,10 @@ export const Schema = {
12
12
  collection: z.object({
13
13
  title: z.string(),
14
14
  description: z.string(),
15
+ owner: z.object({
16
+ id: z.number(),
17
+ username: z.string(),
18
+ }),
15
19
  beatmaps: z.array(
16
20
  z.object({
17
21
  id: z.number(),
@@ -47,7 +51,15 @@ export async function POST(request: Request) {
47
51
  export async function handler(data: (typeof Schema)["input"]["_type"]) {
48
52
  let { data: queryCollectionData, error: collectionError } = await supabase
49
53
  .from("beatmapCollections")
50
- .select("*")
54
+ .select(
55
+ `
56
+ *,
57
+ profiles!inner(
58
+ id,
59
+ username
60
+ )
61
+ `
62
+ )
51
63
  .eq("id", data.collection)
52
64
  .single();
53
65
 
@@ -104,6 +116,10 @@ export async function handler(data: (typeof Schema)["input"]["_type"]) {
104
116
 
105
117
  return NextResponse.json({
106
118
  collection: {
119
+ owner: {
120
+ username: queryCollectionData.profiles.username,
121
+ id: queryCollectionData.profiles.id,
122
+ },
107
123
  title: queryCollectionData.title,
108
124
  description: queryCollectionData.description,
109
125
  beatmaps: formattedBeatmaps,
package/index.ts CHANGED
@@ -511,6 +511,10 @@ export const Schema = {
511
511
  collection: z.object({
512
512
  title: z.string(),
513
513
  description: z.string(),
514
+ owner: z.object({
515
+ id: z.number(),
516
+ username: z.string(),
517
+ }),
514
518
  beatmaps: z.array(
515
519
  z.object({
516
520
  id: z.number(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "179.0.0",
3
+ "version": "180.0.0",
4
4
  "main": "index.ts",
5
5
  "author": "online-contributors",
6
6
  "scripts": {