rhythia-api 231.0.0 → 234.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/.codex +0 -0
- package/.env +1 -12
- package/README.md +4 -4
- package/api/acceptInvite.ts +1 -1
- package/api/addCollectionMap.ts +1 -1
- package/api/chartPublicStats.ts +1 -1
- package/api/checkQualified.ts +93 -83
- package/api/createBeatmap.ts +53 -62
- package/api/createBeatmapPage.ts +1 -1
- package/api/createClan.ts +1 -1
- package/api/createCollection.ts +1 -1
- package/api/createInvite.ts +1 -1
- package/api/createSupporter.ts +1 -1
- package/api/deleteBeatmapPage.ts +2 -5
- package/api/deleteCollection.ts +1 -1
- package/api/deleteCollectionMap.ts +1 -1
- package/api/editAboutMe.ts +1 -1
- package/api/editClan.ts +1 -1
- package/api/editCollection.ts +1 -2
- package/api/editProfile.ts +1 -1
- package/api/enhancedSearch.ts +113 -0
- package/api/executeAdminOperation.ts +1 -22
- package/api/getAvatarUploadUrl.ts +1 -1
- package/api/getBadgeLeaders.ts +1 -1
- package/api/getBadgedUsers.ts +1 -1
- package/api/getBeatmapComments.ts +1 -1
- package/api/getBeatmapPage.ts +74 -106
- package/api/getBeatmapPageById.ts +70 -109
- package/api/getBeatmapStarRating.ts +1 -1
- package/api/getBeatmaps.ts +1 -1
- package/api/getClan.ts +1 -1
- package/api/getClans.ts +1 -1
- package/api/getCollection.ts +1 -1
- package/api/getCollections.ts +1 -1
- package/api/getInventory.ts +1 -1
- package/api/getLeaderboard.ts +1 -1
- package/api/getMapUploadUrl.ts +2 -2
- package/api/getOnlinePlayers.ts +1 -1
- package/api/getPassToken.ts +1 -1
- package/api/getProfile.ts +51 -31
- package/api/getPublicStats.ts +5 -5
- package/api/getRawStarRating.ts +1 -1
- package/api/getScore.ts +1 -1
- package/api/getStoryBeatmaps.ts +1 -1
- package/api/getTimestamp.ts +1 -1
- package/api/getUserScores.ts +19 -19
- package/api/getVerified.ts +1 -1
- package/api/getVideoUploadUrl.ts +1 -1
- package/api/postBeatmapComment.ts +1 -1
- package/api/qualifyMap.ts +97 -86
- package/api/rankMapsArchive.ts +8 -1
- package/api/searchUsers.ts +1 -1
- package/api/setPasskey.ts +1 -1
- package/api/submitScore.ts +1 -6
- package/api/submitScoreInternal.ts +461 -449
- package/api/updateBeatmapPage.ts +1 -1
- package/api/vetoMap.ts +101 -94
- package/index.ts +173 -120
- package/package.json +7 -12
- package/queries/admin_delete_user.sql +39 -39
- package/queries/admin_exclude_user.sql +21 -21
- package/queries/admin_invalidate_ranked_scores.sql +18 -18
- package/queries/admin_log_action.sql +10 -10
- package/queries/admin_profanity_clear.sql +29 -29
- package/queries/admin_remove_all_scores.sql +29 -29
- package/queries/admin_restrict_user.sql +21 -21
- package/queries/admin_search_users.sql +24 -24
- package/queries/admin_silence_user.sql +21 -21
- package/queries/admin_unban_user.sql +21 -21
- package/queries/enhanced_search.sql +217 -0
- package/queries/get_badge_leaderboard.sql +50 -50
- package/queries/get_clan_leaderboard.sql +68 -68
- package/queries/get_collections_v4.sql +109 -109
- package/queries/get_top_scores_for_beatmap.sql +44 -44
- package/queries/get_top_scores_for_beatmap3.sql +38 -0
- package/queries/get_user_by_email.sql +32 -32
- package/queries/get_user_scores_lastday.sql +47 -47
- package/queries/get_user_scores_reign.sql +31 -31
- package/queries/get_user_scores_top_and_stats.sql +84 -84
- package/queries/grant_special_badges.sql +69 -69
- package/types/database.ts +1288 -1224
- package/utils/beatmapTopScores.ts +84 -0
- package/utils/mapLifecycleWebhook.ts +287 -0
- package/utils/requestGeo.ts +13 -0
- package/utils/requestUtils.ts +127 -127
- package/utils/response.ts +11 -0
- package/worker.ts +189 -0
- package/wrangler.jsonc +10 -0
- package/index.html +0 -3
- package/vercel.json +0 -13
package/api/updateBeatmapPage.ts
CHANGED
package/api/vetoMap.ts
CHANGED
|
@@ -1,94 +1,101 @@
|
|
|
1
|
-
import { NextResponse } from "
|
|
2
|
-
import z from "zod";
|
|
3
|
-
import { protectedApi, validUser } from "../utils/requestUtils";
|
|
4
|
-
import { supabase } from "../utils/supabase";
|
|
5
|
-
import { getUserBySession } from "../utils/getUserBySession";
|
|
6
|
-
import { User } from "@supabase/supabase-js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
.
|
|
52
|
-
.
|
|
53
|
-
.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
.
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
1
|
+
import { NextResponse } from "../utils/response";
|
|
2
|
+
import z from "zod";
|
|
3
|
+
import { protectedApi, validUser } from "../utils/requestUtils";
|
|
4
|
+
import { supabase } from "../utils/supabase";
|
|
5
|
+
import { getUserBySession } from "../utils/getUserBySession";
|
|
6
|
+
import { User } from "@supabase/supabase-js";
|
|
7
|
+
import { postMapLifecycleWebhook } from "../utils/mapLifecycleWebhook";
|
|
8
|
+
|
|
9
|
+
const VETO_BADGES = ["Team Ranked"];
|
|
10
|
+
|
|
11
|
+
export const Schema = {
|
|
12
|
+
input: z.strictObject({
|
|
13
|
+
session: z.string(),
|
|
14
|
+
mapId: z.number(),
|
|
15
|
+
reason: z.string().min(1).max(1000),
|
|
16
|
+
}),
|
|
17
|
+
output: z.object({
|
|
18
|
+
error: z.string().optional(),
|
|
19
|
+
}),
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export async function POST(request: Request) {
|
|
23
|
+
return protectedApi({
|
|
24
|
+
request,
|
|
25
|
+
schema: Schema,
|
|
26
|
+
authorization: validUser,
|
|
27
|
+
activity: handler,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function handler(data: (typeof Schema)["input"]["_type"]) {
|
|
32
|
+
const user = (await getUserBySession(data.session)) as User;
|
|
33
|
+
const { data: queryUserData } = await supabase
|
|
34
|
+
.from("profiles")
|
|
35
|
+
.select("*")
|
|
36
|
+
.eq("uid", user.id)
|
|
37
|
+
.single();
|
|
38
|
+
|
|
39
|
+
if (!queryUserData) {
|
|
40
|
+
return NextResponse.json({ error: "Can't find user" });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const tags = (queryUserData?.badges || []) as string[];
|
|
44
|
+
const hasVetoAccess = VETO_BADGES.some((badge) => tags.includes(badge));
|
|
45
|
+
|
|
46
|
+
if (!hasVetoAccess) {
|
|
47
|
+
return NextResponse.json({ error: "Only management can veto maps!" });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const { data: mapData } = await supabase
|
|
51
|
+
.from("beatmapPages")
|
|
52
|
+
.select("id,qualified")
|
|
53
|
+
.eq("id", data.mapId)
|
|
54
|
+
.single();
|
|
55
|
+
|
|
56
|
+
if (!mapData) {
|
|
57
|
+
return NextResponse.json({ error: "Bad map" });
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (!mapData.qualified) {
|
|
61
|
+
return NextResponse.json({
|
|
62
|
+
error: "Only qualified maps can be vetoed",
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const { data: vetoData, error: vetoError } = await supabase
|
|
67
|
+
.from("vetos")
|
|
68
|
+
.insert({
|
|
69
|
+
beatmapPage: data.mapId,
|
|
70
|
+
user: queryUserData.id,
|
|
71
|
+
veto_reason: data.reason,
|
|
72
|
+
})
|
|
73
|
+
.select("id")
|
|
74
|
+
.single();
|
|
75
|
+
|
|
76
|
+
if (vetoError) {
|
|
77
|
+
return NextResponse.json({ error: vetoError.message });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
const { error: updateError } = await supabase.from("beatmapPages").upsert({
|
|
81
|
+
id: data.mapId,
|
|
82
|
+
qualified: false,
|
|
83
|
+
qualifiedAt: null,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (updateError) {
|
|
87
|
+
if (vetoData?.id) {
|
|
88
|
+
await supabase.from("vetos").delete().eq("id", vetoData.id);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return NextResponse.json({ error: updateError.message });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
await postMapLifecycleWebhook({
|
|
95
|
+
mapId: data.mapId,
|
|
96
|
+
event: "vetoed",
|
|
97
|
+
vetoReason: data.reason,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
return NextResponse.json({});
|
|
101
|
+
}
|
package/index.ts
CHANGED
|
@@ -47,14 +47,14 @@ export const chartPublicStats = handleApi({url:"/api/chartPublicStats",...ChartP
|
|
|
47
47
|
// ./api/checkQualified.ts API
|
|
48
48
|
|
|
49
49
|
/*
|
|
50
|
-
export const Schema = {
|
|
51
|
-
input: z.strictObject({
|
|
52
|
-
secret: z.string(),
|
|
53
|
-
}),
|
|
54
|
-
output: z.object({
|
|
55
|
-
error: z.string().optional(),
|
|
56
|
-
updated: z.number(),
|
|
57
|
-
}),
|
|
50
|
+
export const Schema = {
|
|
51
|
+
input: z.strictObject({
|
|
52
|
+
secret: z.string(),
|
|
53
|
+
}),
|
|
54
|
+
output: z.object({
|
|
55
|
+
error: z.string().optional(),
|
|
56
|
+
updated: z.number(),
|
|
57
|
+
}),
|
|
58
58
|
};*/
|
|
59
59
|
import { Schema as CheckQualified } from "./api/checkQualified"
|
|
60
60
|
export { Schema as SchemaCheckQualified } from "./api/checkQualified"
|
|
@@ -63,7 +63,17 @@ export const checkQualified = handleApi({url:"/api/checkQualified",...CheckQuali
|
|
|
63
63
|
// ./api/createBeatmap.ts API
|
|
64
64
|
|
|
65
65
|
/*
|
|
66
|
-
|
|
66
|
+
export const Schema = {
|
|
67
|
+
input: z.strictObject({
|
|
68
|
+
url: z.string(),
|
|
69
|
+
session: z.string(),
|
|
70
|
+
updateFlag: z.boolean().optional(),
|
|
71
|
+
}),
|
|
72
|
+
output: z.strictObject({
|
|
73
|
+
hash: z.string().optional(),
|
|
74
|
+
error: z.string().optional(),
|
|
75
|
+
}),
|
|
76
|
+
};*/
|
|
67
77
|
import { Schema as CreateBeatmap } from "./api/createBeatmap"
|
|
68
78
|
export { Schema as SchemaCreateBeatmap } from "./api/createBeatmap"
|
|
69
79
|
export const createBeatmap = handleApi({url:"/api/createBeatmap",...CreateBeatmap})
|
|
@@ -308,6 +318,47 @@ import { Schema as EditProfile } from "./api/editProfile"
|
|
|
308
318
|
export { Schema as SchemaEditProfile } from "./api/editProfile"
|
|
309
319
|
export const editProfile = handleApi({url:"/api/editProfile",...EditProfile})
|
|
310
320
|
|
|
321
|
+
// ./api/enhancedSearch.ts API
|
|
322
|
+
|
|
323
|
+
/*
|
|
324
|
+
export const Schema = {
|
|
325
|
+
input: z.strictObject({
|
|
326
|
+
text: z.string().trim().min(1),
|
|
327
|
+
limit: z.number().int().min(1).max(25).default(10),
|
|
328
|
+
}),
|
|
329
|
+
output: z.object({
|
|
330
|
+
error: z.string().optional(),
|
|
331
|
+
users: z.array(
|
|
332
|
+
z.object({
|
|
333
|
+
id: z.number(),
|
|
334
|
+
username: z.string().nullable(),
|
|
335
|
+
avatar_url: z.string().nullable(),
|
|
336
|
+
about_me: z.string().nullable(),
|
|
337
|
+
flag: z.string().nullable(),
|
|
338
|
+
})
|
|
339
|
+
),
|
|
340
|
+
beatmaps: z.array(
|
|
341
|
+
z.object({
|
|
342
|
+
id: z.number(),
|
|
343
|
+
mapId: z.string().nullable(),
|
|
344
|
+
title: z.string().nullable(),
|
|
345
|
+
description: z.string().nullable(),
|
|
346
|
+
image: z.string().nullable(),
|
|
347
|
+
starRating: z.number().nullable(),
|
|
348
|
+
length: z.number().nullable(),
|
|
349
|
+
status: z.string().nullable(),
|
|
350
|
+
tags: z.string().nullable(),
|
|
351
|
+
owner: z.number().nullable(),
|
|
352
|
+
ownerUsername: z.string().nullable(),
|
|
353
|
+
ownerAvatar: z.string().nullable(),
|
|
354
|
+
})
|
|
355
|
+
),
|
|
356
|
+
}),
|
|
357
|
+
};*/
|
|
358
|
+
import { Schema as EnhancedSearch } from "./api/enhancedSearch"
|
|
359
|
+
export { Schema as SchemaEnhancedSearch } from "./api/enhancedSearch"
|
|
360
|
+
export const enhancedSearch = handleApi({url:"/api/enhancedSearch",...EnhancedSearch})
|
|
361
|
+
|
|
311
362
|
// ./api/executeAdminOperation.ts API
|
|
312
363
|
|
|
313
364
|
/*
|
|
@@ -469,30 +520,30 @@ export const Schema = {
|
|
|
469
520
|
image: z.string().nullable().optional(),
|
|
470
521
|
imageLarge: z.string().nullable().optional(),
|
|
471
522
|
starRating: z.number().nullable().optional(),
|
|
472
|
-
owner: z.number().nullable().optional(),
|
|
473
|
-
ownerUsername: z.string().nullable().optional(),
|
|
474
|
-
ownerAvatar: z.string().nullable().optional(),
|
|
475
|
-
status: z.string().nullable().optional(),
|
|
476
|
-
qualified: z.boolean().nullable().optional(),
|
|
477
|
-
qualifiedAt: z.string().nullable().optional(),
|
|
478
|
-
description: z.string().nullable().optional(),
|
|
479
|
-
tags: z.string().nullable().optional(),
|
|
480
|
-
videoUrl: z.string().nullable().optional(),
|
|
481
|
-
vetos: z
|
|
482
|
-
.array(
|
|
483
|
-
z.object({
|
|
484
|
-
id: z.number(),
|
|
485
|
-
userId: z.number().nullable().optional(),
|
|
486
|
-
username: z.string().nullable().optional(),
|
|
487
|
-
avatar_url: z.string().nullable().optional(),
|
|
488
|
-
veto_reason: z.string().nullable().optional(),
|
|
489
|
-
created_at: z.string().nullable().optional(),
|
|
490
|
-
})
|
|
491
|
-
)
|
|
492
|
-
.optional(),
|
|
493
|
-
})
|
|
494
|
-
.optional(),
|
|
495
|
-
}),
|
|
523
|
+
owner: z.number().nullable().optional(),
|
|
524
|
+
ownerUsername: z.string().nullable().optional(),
|
|
525
|
+
ownerAvatar: z.string().nullable().optional(),
|
|
526
|
+
status: z.string().nullable().optional(),
|
|
527
|
+
qualified: z.boolean().nullable().optional(),
|
|
528
|
+
qualifiedAt: z.string().nullable().optional(),
|
|
529
|
+
description: z.string().nullable().optional(),
|
|
530
|
+
tags: z.string().nullable().optional(),
|
|
531
|
+
videoUrl: z.string().nullable().optional(),
|
|
532
|
+
vetos: z
|
|
533
|
+
.array(
|
|
534
|
+
z.object({
|
|
535
|
+
id: z.number(),
|
|
536
|
+
userId: z.number().nullable().optional(),
|
|
537
|
+
username: z.string().nullable().optional(),
|
|
538
|
+
avatar_url: z.string().nullable().optional(),
|
|
539
|
+
veto_reason: z.string().nullable().optional(),
|
|
540
|
+
created_at: z.string().nullable().optional(),
|
|
541
|
+
})
|
|
542
|
+
)
|
|
543
|
+
.optional(),
|
|
544
|
+
})
|
|
545
|
+
.optional(),
|
|
546
|
+
}),
|
|
496
547
|
};*/
|
|
497
548
|
import { Schema as GetBeatmapPage } from "./api/getBeatmapPage"
|
|
498
549
|
export { Schema as SchemaGetBeatmapPage } from "./api/getBeatmapPage"
|
|
@@ -524,6 +575,7 @@ export const Schema = {
|
|
|
524
575
|
userId: z.number().nullable(),
|
|
525
576
|
username: z.string().nullable(),
|
|
526
577
|
avatar_url: z.string().nullable(),
|
|
578
|
+
accuracy: z.number().nullable(),
|
|
527
579
|
})
|
|
528
580
|
)
|
|
529
581
|
.optional(),
|
|
@@ -542,28 +594,28 @@ export const Schema = {
|
|
|
542
594
|
beatmapFile: z.string().nullable().optional(),
|
|
543
595
|
image: z.string().nullable().optional(),
|
|
544
596
|
starRating: z.number().nullable().optional(),
|
|
545
|
-
owner: z.number().nullable().optional(),
|
|
546
|
-
ownerUsername: z.string().nullable().optional(),
|
|
547
|
-
ownerAvatar: z.string().nullable().optional(),
|
|
548
|
-
status: z.string().nullable().optional(),
|
|
549
|
-
qualified: z.boolean().nullable().optional(),
|
|
550
|
-
qualifiedAt: z.string().nullable().optional(),
|
|
551
|
-
videoUrl: z.string().nullable(),
|
|
552
|
-
vetos: z
|
|
553
|
-
.array(
|
|
554
|
-
z.object({
|
|
555
|
-
id: z.number(),
|
|
556
|
-
userId: z.number().nullable().optional(),
|
|
557
|
-
username: z.string().nullable().optional(),
|
|
558
|
-
avatar_url: z.string().nullable().optional(),
|
|
559
|
-
veto_reason: z.string().nullable().optional(),
|
|
560
|
-
created_at: z.string().nullable().optional(),
|
|
561
|
-
})
|
|
562
|
-
)
|
|
563
|
-
.optional(),
|
|
564
|
-
})
|
|
565
|
-
.optional(),
|
|
566
|
-
}),
|
|
597
|
+
owner: z.number().nullable().optional(),
|
|
598
|
+
ownerUsername: z.string().nullable().optional(),
|
|
599
|
+
ownerAvatar: z.string().nullable().optional(),
|
|
600
|
+
status: z.string().nullable().optional(),
|
|
601
|
+
qualified: z.boolean().nullable().optional(),
|
|
602
|
+
qualifiedAt: z.string().nullable().optional(),
|
|
603
|
+
videoUrl: z.string().nullable(),
|
|
604
|
+
vetos: z
|
|
605
|
+
.array(
|
|
606
|
+
z.object({
|
|
607
|
+
id: z.number(),
|
|
608
|
+
userId: z.number().nullable().optional(),
|
|
609
|
+
username: z.string().nullable().optional(),
|
|
610
|
+
avatar_url: z.string().nullable().optional(),
|
|
611
|
+
veto_reason: z.string().nullable().optional(),
|
|
612
|
+
created_at: z.string().nullable().optional(),
|
|
613
|
+
})
|
|
614
|
+
)
|
|
615
|
+
.optional(),
|
|
616
|
+
})
|
|
617
|
+
.optional(),
|
|
618
|
+
}),
|
|
567
619
|
};*/
|
|
568
620
|
import { Schema as GetBeatmapPageById } from "./api/getBeatmapPageById"
|
|
569
621
|
export { Schema as SchemaGetBeatmapPageById } from "./api/getBeatmapPageById"
|
|
@@ -940,15 +992,16 @@ export const Schema = {
|
|
|
940
992
|
verified: z.boolean().nullable(),
|
|
941
993
|
verificationDeadline: z.number().nullable(),
|
|
942
994
|
play_count: z.number().nullable(),
|
|
943
|
-
skill_points: z.number().nullable(),
|
|
944
|
-
squares_hit: z.number().nullable(),
|
|
945
|
-
total_score: z.number().nullable(),
|
|
946
|
-
position: z.number().nullable(),
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
995
|
+
skill_points: z.number().nullable(),
|
|
996
|
+
squares_hit: z.number().nullable(),
|
|
997
|
+
total_score: z.number().nullable(),
|
|
998
|
+
position: z.number().nullable(),
|
|
999
|
+
country_position: z.number().nullable(),
|
|
1000
|
+
activity_status: z.enum(["active", "inactive"]),
|
|
1001
|
+
is_online: z.boolean(),
|
|
1002
|
+
clans: z
|
|
1003
|
+
.object({
|
|
1004
|
+
id: z.number(),
|
|
952
1005
|
acronym: z.string(),
|
|
953
1006
|
})
|
|
954
1007
|
.optional()
|
|
@@ -1144,12 +1197,12 @@ export const Schema = {
|
|
|
1144
1197
|
awarded_sp: z.number().nullable(),
|
|
1145
1198
|
beatmapHash: z.string().nullable(),
|
|
1146
1199
|
created_at: z.string(),
|
|
1147
|
-
id: z.number(),
|
|
1148
|
-
misses: z.number().nullable(),
|
|
1149
|
-
passed: z.boolean().nullable(),
|
|
1150
|
-
replay_url: z.string().nullable().optional(),
|
|
1151
|
-
songId: z.string().nullable(),
|
|
1152
|
-
userId: z.number().nullable(),
|
|
1200
|
+
id: z.number(),
|
|
1201
|
+
misses: z.number().nullable(),
|
|
1202
|
+
passed: z.boolean().nullable(),
|
|
1203
|
+
replay_url: z.string().nullable().optional(),
|
|
1204
|
+
songId: z.string().nullable(),
|
|
1205
|
+
userId: z.number().nullable(),
|
|
1153
1206
|
beatmapDifficulty: z.number().optional().nullable(),
|
|
1154
1207
|
beatmapNotes: z.number().optional().nullable(),
|
|
1155
1208
|
beatmapTitle: z.string().optional().nullable(),
|
|
@@ -1164,12 +1217,12 @@ export const Schema = {
|
|
|
1164
1217
|
id: z.number(),
|
|
1165
1218
|
awarded_sp: z.number().nullable(),
|
|
1166
1219
|
created_at: z.string(),
|
|
1167
|
-
misses: z.number().nullable(),
|
|
1168
|
-
mods: z.record(z.unknown()),
|
|
1169
|
-
passed: z.boolean().nullable(),
|
|
1170
|
-
replay_url: z.string().nullable().optional(),
|
|
1171
|
-
songId: z.string().nullable(),
|
|
1172
|
-
speed: z.number().nullable(),
|
|
1220
|
+
misses: z.number().nullable(),
|
|
1221
|
+
mods: z.record(z.unknown()),
|
|
1222
|
+
passed: z.boolean().nullable(),
|
|
1223
|
+
replay_url: z.string().nullable().optional(),
|
|
1224
|
+
songId: z.string().nullable(),
|
|
1225
|
+
speed: z.number().nullable(),
|
|
1173
1226
|
spin: z.boolean(),
|
|
1174
1227
|
beatmapHash: z.string().nullable(),
|
|
1175
1228
|
beatmapTitle: z.string().nullable(),
|
|
@@ -1184,12 +1237,12 @@ export const Schema = {
|
|
|
1184
1237
|
awarded_sp: z.number().nullable(),
|
|
1185
1238
|
beatmapHash: z.string().nullable(),
|
|
1186
1239
|
created_at: z.string(),
|
|
1187
|
-
id: z.number(),
|
|
1188
|
-
misses: z.number().nullable(),
|
|
1189
|
-
passed: z.boolean().nullable(),
|
|
1190
|
-
replay_url: z.string().nullable().optional(),
|
|
1191
|
-
rank: z.string().nullable(),
|
|
1192
|
-
songId: z.string().nullable(),
|
|
1240
|
+
id: z.number(),
|
|
1241
|
+
misses: z.number().nullable(),
|
|
1242
|
+
passed: z.boolean().nullable(),
|
|
1243
|
+
replay_url: z.string().nullable().optional(),
|
|
1244
|
+
rank: z.string().nullable(),
|
|
1245
|
+
songId: z.string().nullable(),
|
|
1193
1246
|
userId: z.number().nullable(),
|
|
1194
1247
|
beatmapDifficulty: z.number().optional().nullable(),
|
|
1195
1248
|
beatmapNotes: z.number().optional().nullable(),
|
|
@@ -1264,15 +1317,15 @@ export const postBeatmapComment = handleApi({url:"/api/postBeatmapComment",...Po
|
|
|
1264
1317
|
// ./api/qualifyMap.ts API
|
|
1265
1318
|
|
|
1266
1319
|
/*
|
|
1267
|
-
export const Schema = {
|
|
1268
|
-
input: z.strictObject({
|
|
1269
|
-
session: z.string(),
|
|
1270
|
-
mapId: z.number(),
|
|
1271
|
-
}),
|
|
1272
|
-
output: z.object({
|
|
1273
|
-
error: z.string().optional(),
|
|
1274
|
-
qualifiedAt: z.string().optional(),
|
|
1275
|
-
}),
|
|
1320
|
+
export const Schema = {
|
|
1321
|
+
input: z.strictObject({
|
|
1322
|
+
session: z.string(),
|
|
1323
|
+
mapId: z.number(),
|
|
1324
|
+
}),
|
|
1325
|
+
output: z.object({
|
|
1326
|
+
error: z.string().optional(),
|
|
1327
|
+
qualifiedAt: z.string().optional(),
|
|
1328
|
+
}),
|
|
1276
1329
|
};*/
|
|
1277
1330
|
import { Schema as QualifyMap } from "./api/qualifyMap"
|
|
1278
1331
|
export { Schema as SchemaQualifyMap } from "./api/qualifyMap"
|
|
@@ -1367,26 +1420,26 @@ export const submitScore = handleApi({url:"/api/submitScore",...SubmitScore})
|
|
|
1367
1420
|
// ./api/submitScoreInternal.ts API
|
|
1368
1421
|
|
|
1369
1422
|
/*
|
|
1370
|
-
export const Schema = {
|
|
1371
|
-
input: z.strictObject({
|
|
1372
|
-
session: z.string(),
|
|
1373
|
-
secret: z.string(),
|
|
1374
|
-
token: z.string(),
|
|
1375
|
-
data: z.strictObject({
|
|
1376
|
-
onlineMapId: z.number(),
|
|
1377
|
-
misses: z.number(),
|
|
1378
|
-
hits: z.number(),
|
|
1379
|
-
speed: z.number(),
|
|
1380
|
-
mods: z.array(z.string()),
|
|
1381
|
-
spin: z.boolean(),
|
|
1382
|
-
replayBytes: z.string().nullable().optional(),
|
|
1383
|
-
pauses: z.number().nullable().optional(),
|
|
1384
|
-
failTime: z.number().nullable().optional(),
|
|
1385
|
-
}),
|
|
1386
|
-
}),
|
|
1387
|
-
output: z.object({
|
|
1388
|
-
error: z.string().optional(),
|
|
1389
|
-
}),
|
|
1423
|
+
export const Schema = {
|
|
1424
|
+
input: z.strictObject({
|
|
1425
|
+
session: z.string(),
|
|
1426
|
+
secret: z.string(),
|
|
1427
|
+
token: z.string(),
|
|
1428
|
+
data: z.strictObject({
|
|
1429
|
+
onlineMapId: z.number(),
|
|
1430
|
+
misses: z.number(),
|
|
1431
|
+
hits: z.number(),
|
|
1432
|
+
speed: z.number(),
|
|
1433
|
+
mods: z.array(z.string()),
|
|
1434
|
+
spin: z.boolean(),
|
|
1435
|
+
replayBytes: z.string().nullable().optional(),
|
|
1436
|
+
pauses: z.number().nullable().optional(),
|
|
1437
|
+
failTime: z.number().nullable().optional(),
|
|
1438
|
+
}),
|
|
1439
|
+
}),
|
|
1440
|
+
output: z.object({
|
|
1441
|
+
error: z.string().optional(),
|
|
1442
|
+
}),
|
|
1390
1443
|
};*/
|
|
1391
1444
|
import { Schema as SubmitScoreInternal } from "./api/submitScoreInternal"
|
|
1392
1445
|
export { Schema as SchemaSubmitScoreInternal } from "./api/submitScoreInternal"
|
|
@@ -1415,15 +1468,15 @@ export const updateBeatmapPage = handleApi({url:"/api/updateBeatmapPage",...Upda
|
|
|
1415
1468
|
// ./api/vetoMap.ts API
|
|
1416
1469
|
|
|
1417
1470
|
/*
|
|
1418
|
-
export const Schema = {
|
|
1419
|
-
input: z.strictObject({
|
|
1420
|
-
session: z.string(),
|
|
1421
|
-
mapId: z.number(),
|
|
1422
|
-
reason: z.string().min(1).max(1000),
|
|
1423
|
-
}),
|
|
1424
|
-
output: z.object({
|
|
1425
|
-
error: z.string().optional(),
|
|
1426
|
-
}),
|
|
1471
|
+
export const Schema = {
|
|
1472
|
+
input: z.strictObject({
|
|
1473
|
+
session: z.string(),
|
|
1474
|
+
mapId: z.number(),
|
|
1475
|
+
reason: z.string().min(1).max(1000),
|
|
1476
|
+
}),
|
|
1477
|
+
output: z.object({
|
|
1478
|
+
error: z.string().optional(),
|
|
1479
|
+
}),
|
|
1427
1480
|
};*/
|
|
1428
1481
|
import { Schema as VetoMap } from "./api/vetoMap"
|
|
1429
1482
|
export { Schema as SchemaVetoMap } from "./api/vetoMap"
|
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rhythia-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "234.0.0",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"author": "online-contributors-cunev",
|
|
6
6
|
"scripts": {
|
|
7
|
+
"dev": "wrangler dev",
|
|
8
|
+
"deploy": "wrangler deploy",
|
|
7
9
|
"update": "bun ./scripts/update.ts",
|
|
8
|
-
"ci-deploy": "tsx ./scripts/ci-deploy.ts",
|
|
9
10
|
"test": "tsx ./scripts/test.ts",
|
|
10
11
|
"cache:clear-user-scores": "bun run scripts/clear-user-score-cache.ts",
|
|
11
12
|
"db:optimize-user-scores": "bun run scripts/optimize-user-scores-indexes.ts",
|
|
@@ -13,28 +14,20 @@
|
|
|
13
14
|
"query-push": "bun run scripts/deploy-queries.ts",
|
|
14
15
|
"queries:pull": "bun run scripts/pull-queries.ts",
|
|
15
16
|
"queries:deploy": "bun run scripts/deploy-queries.ts",
|
|
16
|
-
"sync": "npx supabase gen types typescript --project-id \"pfkajngbllcbdzoylrvp\" --schema public > types/database.ts"
|
|
17
|
-
"pipeline:build-api": "tsx ./scripts/build.ts",
|
|
18
|
-
"pipeline:deploy-testing": "tsx ./scripts/build.ts"
|
|
17
|
+
"sync": "npx supabase gen types typescript --project-id \"pfkajngbllcbdzoylrvp\" --schema public > types/database.ts"
|
|
19
18
|
},
|
|
20
19
|
"license": "MIT",
|
|
21
20
|
"dependencies": {
|
|
22
21
|
"@2toad/profanity": "^3.0.0",
|
|
23
22
|
"@aws-sdk/client-s3": "^3.637.0",
|
|
24
|
-
"@aws-sdk/node-http-handler": "^3.374.0",
|
|
25
23
|
"@aws-sdk/s3-request-presigner": "^3.637.0",
|
|
26
|
-
"@netlify/zip-it-and-ship-it": "^9.37.9",
|
|
27
24
|
"@noble/ciphers": "^1.0.0",
|
|
28
25
|
"@supabase/supabase-js": "^2.45.1",
|
|
29
|
-
"@types/aws-lambda": "^8.10.143",
|
|
30
26
|
"@types/bun": "^1.1.6",
|
|
31
27
|
"@types/lodash": "^4.17.7",
|
|
32
28
|
"@types/node": "^22.2.0",
|
|
33
29
|
"@types/pg": "^8.15.5",
|
|
34
30
|
"@types/validator": "^13.12.2",
|
|
35
|
-
"@vercel/edge": "^1.1.2",
|
|
36
|
-
"@vercel/node": "^3.2.8",
|
|
37
|
-
"aws-lambda": "^1.0.7",
|
|
38
31
|
"bad-words": "^4.0.0",
|
|
39
32
|
"badwords-list": "^2.0.1-4",
|
|
40
33
|
"bufferutil": "^4.0.8",
|
|
@@ -43,7 +36,6 @@
|
|
|
43
36
|
"esbuild": "^0.23.0",
|
|
44
37
|
"isomorphic-git": "^1.27.1",
|
|
45
38
|
"lodash": "^4.17.21",
|
|
46
|
-
"next": "^14.2.5",
|
|
47
39
|
"osu-classes": "^3.1.0",
|
|
48
40
|
"osu-parsers": "^4.1.7",
|
|
49
41
|
"osu-standard-stable": "^5.0.0",
|
|
@@ -61,5 +53,8 @@
|
|
|
61
53
|
"zero-width": "^1.0.29",
|
|
62
54
|
"zod": "^3.24.2"
|
|
63
55
|
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"wrangler": "^4.12.0"
|
|
58
|
+
},
|
|
64
59
|
"packageManager": "yarn@1.22.22"
|
|
65
60
|
}
|