rhythia-api 137.0.0 → 138.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.
- package/api/getBeatmaps.ts +13 -0
- package/api/updateBeatmapPage.ts +6 -0
- package/package.json +1 -1
package/api/getBeatmaps.ts
CHANGED
|
@@ -11,6 +11,8 @@ export const Schema = {
|
|
|
11
11
|
tagsFilter: z.string().optional(),
|
|
12
12
|
page: z.number().default(1),
|
|
13
13
|
maxStars: z.number().optional(),
|
|
14
|
+
minLength: z.number().optional(),
|
|
15
|
+
maxLength: z.number().optional(),
|
|
14
16
|
minStars: z.number().optional(),
|
|
15
17
|
creator: z.number().optional(),
|
|
16
18
|
status: z.string().optional(),
|
|
@@ -86,6 +88,7 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
|
|
|
86
88
|
image,
|
|
87
89
|
starRating,
|
|
88
90
|
difficulty,
|
|
91
|
+
length,
|
|
89
92
|
title
|
|
90
93
|
),
|
|
91
94
|
profiles!inner(
|
|
@@ -113,6 +116,15 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
|
|
|
113
116
|
if (data.maxStars) {
|
|
114
117
|
qry = qry.lt("beatmaps.starRating", data.maxStars);
|
|
115
118
|
}
|
|
119
|
+
|
|
120
|
+
if (data.minLength) {
|
|
121
|
+
qry = qry.gt("beatmaps.length", data.minLength);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
if (data.maxLength) {
|
|
125
|
+
qry = qry.lt("beatmaps.length", data.maxLength);
|
|
126
|
+
}
|
|
127
|
+
|
|
116
128
|
if (data.status) {
|
|
117
129
|
qry = qry.eq("status", data.status);
|
|
118
130
|
}
|
|
@@ -135,6 +147,7 @@ export async function getBeatmaps(data: (typeof Schema)["input"]["_type"]) {
|
|
|
135
147
|
difficulty: beatmapPage.beatmaps?.difficulty,
|
|
136
148
|
title: beatmapPage.beatmaps?.title,
|
|
137
149
|
ranked: beatmapPage.beatmaps?.ranked,
|
|
150
|
+
length: beatmapPage.beatmaps?.length,
|
|
138
151
|
beatmapFile: beatmapPage.beatmaps?.beatmapFile,
|
|
139
152
|
image: beatmapPage.beatmaps?.image,
|
|
140
153
|
starRating: beatmapPage.beatmaps?.starRating,
|
package/api/updateBeatmapPage.ts
CHANGED
|
@@ -8,6 +8,8 @@ export const Schema = {
|
|
|
8
8
|
session: z.string(),
|
|
9
9
|
id: z.number(),
|
|
10
10
|
beatmapHash: z.string(),
|
|
11
|
+
tags: z.string(),
|
|
12
|
+
description: z.string(),
|
|
11
13
|
}),
|
|
12
14
|
output: z.strictObject({
|
|
13
15
|
error: z.string().optional(),
|
|
@@ -27,6 +29,8 @@ export async function handler({
|
|
|
27
29
|
session,
|
|
28
30
|
beatmapHash,
|
|
29
31
|
id,
|
|
32
|
+
description,
|
|
33
|
+
tags,
|
|
30
34
|
}: (typeof Schema)["input"]["_type"]): Promise<
|
|
31
35
|
NextResponse<(typeof Schema)["output"]["_type"]>
|
|
32
36
|
> {
|
|
@@ -64,6 +68,8 @@ export async function handler({
|
|
|
64
68
|
title: beatmapData.title,
|
|
65
69
|
status: "UNRANKED",
|
|
66
70
|
owner: userData.id,
|
|
71
|
+
description,
|
|
72
|
+
tags,
|
|
67
73
|
})
|
|
68
74
|
.select("*")
|
|
69
75
|
.single();
|