rhythia-api 215.0.0 → 216.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.
@@ -41,6 +41,7 @@ export const Schema = {
41
41
  ownerAvatar: z.string().nullable().optional(),
42
42
  status: z.string().nullable().optional(),
43
43
  tags: z.string().nullable().optional(),
44
+ videoUrl: z.string().nullable().optional(),
44
45
  })
45
46
  )
46
47
  .optional(),
@@ -80,6 +81,7 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
80
81
  status,
81
82
  tags,
82
83
  ranked_at,
84
+ video_url,
83
85
  beatmaps!inner(
84
86
  playcount,
85
87
  ranked,
@@ -158,6 +160,7 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
158
160
  owner: beatmapPage.owner,
159
161
  status: beatmapPage.status,
160
162
  ownerUsername: beatmapPage.profiles?.username,
163
+ videoUrl: beatmapPage.video_url,
161
164
  })),
162
165
  };
163
166
  }
@@ -74,21 +74,23 @@ export async function handler({
74
74
  if (userData.id !== pageData?.owner)
75
75
  return NextResponse.json({ error: "Non-authz user." });
76
76
 
77
- if (pageData?.status !== "UNRANKED")
78
- return NextResponse.json({ error: "Only unranked maps can be updated" });
79
-
80
- const upsertPayload = {
77
+ const upsertPayload: any = {
81
78
  id,
82
- genre: "",
83
- status: "UNRANKED",
84
79
  owner: userData.id,
85
- description: description ? description : pageData.description,
86
- tags: tags ? tags : pageData.tags,
87
- video_url: videoUrl ? videoUrl : pageData.video_url,
88
80
  updated_at: Date.now(),
89
- } as any;
81
+ };
82
+
83
+ if (typeof description !== "undefined")
84
+ upsertPayload.description = description;
85
+ if (typeof tags !== "undefined") upsertPayload.tags = tags;
86
+ if (typeof videoUrl !== "undefined") upsertPayload.video_url = videoUrl;
90
87
 
91
88
  if (beatmapHash && beatmapData) {
89
+ if (pageData?.status !== "UNRANKED") {
90
+ return NextResponse.json({
91
+ error: "Only unranked maps can be updated",
92
+ });
93
+ }
92
94
  upsertPayload["title"] = beatmapData.title;
93
95
  upsertPayload["latestBeatmapHash"] = beatmapHash;
94
96
  upsertPayload["nominations"] = [];
package/index.ts CHANGED
@@ -579,6 +579,7 @@ export const Schema = {
579
579
  ownerAvatar: z.string().nullable().optional(),
580
580
  status: z.string().nullable().optional(),
581
581
  tags: z.string().nullable().optional(),
582
+ videoUrl: z.string().nullable().optional(),
582
583
  })
583
584
  )
584
585
  .optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "215.0.0",
3
+ "version": "216.0.0",
4
4
  "main": "index.ts",
5
5
  "author": "online-contributors-cunev",
6
6
  "scripts": {