rhythia-api 101.0.0 → 102.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/editProfile.ts +19 -1
- package/api/getProfile.ts +8 -3
- package/api/getUserScores.ts +22 -3
- package/api/submitScore.ts +47 -14
- package/package.json +3 -2
- package/types/database.ts +260 -254
package/api/editProfile.ts
CHANGED
|
@@ -3,7 +3,6 @@ import z from "zod";
|
|
|
3
3
|
import { Database } from "../types/database";
|
|
4
4
|
import { protectedApi, validUser } from "../utils/requestUtils";
|
|
5
5
|
import { supabase } from "../utils/supabase";
|
|
6
|
-
|
|
7
6
|
export const Schema = {
|
|
8
7
|
input: z.strictObject({
|
|
9
8
|
session: z.string(),
|
|
@@ -30,6 +29,24 @@ export async function POST(request: Request): Promise<NextResponse> {
|
|
|
30
29
|
export async function handler(
|
|
31
30
|
data: (typeof Schema)["input"]["_type"]
|
|
32
31
|
): Promise<NextResponse<(typeof Schema)["output"]["_type"]>> {
|
|
32
|
+
if (data.data.username !== undefined && data.data.username.length === 0) {
|
|
33
|
+
return NextResponse.json(
|
|
34
|
+
{
|
|
35
|
+
error: "Username can't be empty",
|
|
36
|
+
},
|
|
37
|
+
{ status: 404 }
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (data.data.username && data.data.username.length > 20) {
|
|
42
|
+
return NextResponse.json(
|
|
43
|
+
{
|
|
44
|
+
error: "Username too long.",
|
|
45
|
+
},
|
|
46
|
+
{ status: 404 }
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
33
50
|
const user = (await supabase.auth.getUser(data.session)).data.user!;
|
|
34
51
|
let userData: Database["public"]["Tables"]["profiles"]["Update"];
|
|
35
52
|
|
|
@@ -53,6 +70,7 @@ export async function handler(
|
|
|
53
70
|
|
|
54
71
|
const upsertPayload: Database["public"]["Tables"]["profiles"]["Update"] = {
|
|
55
72
|
id: userData.id,
|
|
73
|
+
computedUsername: data.data.username?.toLowerCase(),
|
|
56
74
|
...data.data,
|
|
57
75
|
};
|
|
58
76
|
|
package/api/getProfile.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { geolocation } from "@vercel/edge";
|
|
|
2
2
|
import { NextResponse } from "next/server";
|
|
3
3
|
import z from "zod";
|
|
4
4
|
import { Database } from "../types/database";
|
|
5
|
-
import { protectedApi
|
|
5
|
+
import { protectedApi } from "../utils/requestUtils";
|
|
6
6
|
import { supabase } from "../utils/supabase";
|
|
7
7
|
|
|
8
8
|
export const Schema = {
|
|
@@ -77,7 +77,6 @@ export async function handler(
|
|
|
77
77
|
.select("*")
|
|
78
78
|
.eq("uid", user.id);
|
|
79
79
|
|
|
80
|
-
console.log(profiles, error);
|
|
81
80
|
if (!queryData?.length) {
|
|
82
81
|
const geo = geolocation(req);
|
|
83
82
|
const data = await supabase
|
|
@@ -87,7 +86,13 @@ export async function handler(
|
|
|
87
86
|
about_me: "",
|
|
88
87
|
avatar_url: user.user_metadata.avatar_url,
|
|
89
88
|
badges: ["Early Bird"],
|
|
90
|
-
username: user.user_metadata.full_name,
|
|
89
|
+
username: `${user.user_metadata.full_name.slice(0, 20)}${Math.round(
|
|
90
|
+
Math.random() * 900000 + 100000
|
|
91
|
+
)}`,
|
|
92
|
+
computedUsername: `${user.user_metadata.full_name.slice(
|
|
93
|
+
0,
|
|
94
|
+
20
|
|
95
|
+
)}${Math.round(Math.random() * 900000 + 100000)}`.toLowerCase(),
|
|
91
96
|
flag: (geo.country || "US").toUpperCase(),
|
|
92
97
|
created_at: Date.now(),
|
|
93
98
|
})
|
package/api/getUserScores.ts
CHANGED
|
@@ -94,8 +94,27 @@ export async function handler(
|
|
|
94
94
|
.eq("userId", data.id)
|
|
95
95
|
.neq("awarded_sp", 0)
|
|
96
96
|
.eq("passed", true)
|
|
97
|
-
.order("awarded_sp", { ascending: false })
|
|
98
|
-
|
|
97
|
+
.order("awarded_sp", { ascending: false });
|
|
98
|
+
|
|
99
|
+
if (scores2 == null) return NextResponse.json({ error: "No scores" });
|
|
100
|
+
|
|
101
|
+
let hashMap: Record<string, { awarded_sp: number; score: any }> = {};
|
|
102
|
+
|
|
103
|
+
for (const score of scores2) {
|
|
104
|
+
const { beatmapHash, awarded_sp } = score;
|
|
105
|
+
|
|
106
|
+
if (!beatmapHash || !awarded_sp) continue;
|
|
107
|
+
|
|
108
|
+
if (!hashMap[beatmapHash] || hashMap[beatmapHash].awarded_sp < awarded_sp) {
|
|
109
|
+
hashMap[beatmapHash] = { awarded_sp, score };
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const values = Object.values(hashMap);
|
|
114
|
+
let vals = values
|
|
115
|
+
.sort((a, b) => b.awarded_sp - a.awarded_sp)
|
|
116
|
+
.slice(0, 10)
|
|
117
|
+
.map((e) => e.score);
|
|
99
118
|
|
|
100
119
|
return NextResponse.json({
|
|
101
120
|
lastDay: scores1?.map((s) => ({
|
|
@@ -112,7 +131,7 @@ export async function handler(
|
|
|
112
131
|
beatmapNotes: s.beatmaps?.noteCount,
|
|
113
132
|
beatmapTitle: s.beatmaps?.title,
|
|
114
133
|
})),
|
|
115
|
-
top:
|
|
134
|
+
top: vals?.map((s) => ({
|
|
116
135
|
created_at: s.created_at,
|
|
117
136
|
id: s.id,
|
|
118
137
|
passed: s.passed,
|
package/api/submitScore.ts
CHANGED
|
@@ -10,13 +10,14 @@ export const Schema = {
|
|
|
10
10
|
token: z.string(),
|
|
11
11
|
relayHwid: z.string(),
|
|
12
12
|
songId: z.string(),
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
misses: z.number(),
|
|
14
|
+
squareHits: z.number(),
|
|
15
15
|
mapHash: z.string(),
|
|
16
16
|
mapTitle: z.string(),
|
|
17
17
|
mapDifficulty: z.number(),
|
|
18
18
|
mapNoteCount: z.number(),
|
|
19
19
|
mapLength: z.number(),
|
|
20
|
+
passed: z.boolean(),
|
|
20
21
|
sspp: z.number(),
|
|
21
22
|
}),
|
|
22
23
|
}),
|
|
@@ -69,8 +70,7 @@ export async function handler({
|
|
|
69
70
|
newPlaycount = (beatmaps.playcount || 1) + 1;
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
|
|
73
|
-
const p1 = await supabase.from("beatmaps").upsert({
|
|
73
|
+
await supabase.from("beatmaps").upsert({
|
|
74
74
|
beatmapHash: data.mapHash,
|
|
75
75
|
title: data.mapTitle,
|
|
76
76
|
playcount: newPlaycount,
|
|
@@ -80,26 +80,59 @@ export async function handler({
|
|
|
80
80
|
});
|
|
81
81
|
|
|
82
82
|
console.log("p1");
|
|
83
|
-
|
|
83
|
+
await supabase.from("scores").upsert({
|
|
84
84
|
beatmapHash: data.mapHash,
|
|
85
|
-
noteResults:
|
|
85
|
+
noteResults: [],
|
|
86
86
|
replayHwid: data.relayHwid,
|
|
87
87
|
songId: data.songId,
|
|
88
|
-
triggers: data.triggers,
|
|
89
88
|
userId: userData.id,
|
|
90
|
-
passed: data.
|
|
91
|
-
misses:
|
|
92
|
-
awarded_sp: data.sspp,
|
|
89
|
+
passed: data.passed,
|
|
90
|
+
misses: data.misses,
|
|
91
|
+
awarded_sp: Math.round(data.sspp * 100) / 100,
|
|
93
92
|
rank: "A",
|
|
94
93
|
});
|
|
95
94
|
console.log("p2");
|
|
96
95
|
|
|
97
|
-
|
|
96
|
+
let totalSp = 0;
|
|
97
|
+
let { data: scores2, error: errorsp } = await supabase
|
|
98
|
+
.from("scores")
|
|
99
|
+
.select(`awarded_sp,beatmapHash`)
|
|
100
|
+
.eq("userId", userData.id)
|
|
101
|
+
.neq("awarded_sp", 0)
|
|
102
|
+
.eq("passed", true)
|
|
103
|
+
.order("awarded_sp", { ascending: false });
|
|
104
|
+
|
|
105
|
+
if (scores2 == null) return NextResponse.json({ error: "No scores" });
|
|
106
|
+
|
|
107
|
+
let hashMap: Record<string, number> = {};
|
|
108
|
+
|
|
109
|
+
for (const score of scores2) {
|
|
110
|
+
const { beatmapHash, awarded_sp } = score;
|
|
111
|
+
|
|
112
|
+
if (!beatmapHash || !awarded_sp) continue;
|
|
113
|
+
|
|
114
|
+
if (!hashMap[beatmapHash] || hashMap[beatmapHash] < awarded_sp) {
|
|
115
|
+
hashMap[beatmapHash] = awarded_sp;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
let weight = 100;
|
|
119
|
+
const values = Object.values(hashMap);
|
|
120
|
+
values.sort((a, b) => b - a);
|
|
121
|
+
|
|
122
|
+
for (const score of values) {
|
|
123
|
+
totalSp += ((score || 0) * weight) / 100;
|
|
124
|
+
weight -= 1;
|
|
125
|
+
|
|
126
|
+
if (weight == 0) {
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
await supabase.from("profiles").upsert({
|
|
98
132
|
id: userData.id,
|
|
99
133
|
play_count: (userData.play_count || 0) + 1,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
Object.values(data.noteResults).filter((e) => e).length,
|
|
134
|
+
skill_points: Math.round(totalSp * 100) / 100,
|
|
135
|
+
squares_hit: (userData.squares_hit || 0) + data.squareHits,
|
|
103
136
|
});
|
|
104
137
|
console.log("p3");
|
|
105
138
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rhythia-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "102.0.0",
|
|
4
4
|
"main": "index.ts",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"update": "bun ./scripts/update.ts",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"@vercel/edge": "^1.1.2",
|
|
22
22
|
"@vercel/node": "^3.2.8",
|
|
23
23
|
"aws-lambda": "^1.0.7",
|
|
24
|
+
"badwords-list": "^2.0.1-4",
|
|
24
25
|
"bufferutil": "^4.0.8",
|
|
25
26
|
"bun": "^1.1.22",
|
|
26
27
|
"esbuild": "^0.23.0",
|
|
@@ -28,7 +29,7 @@
|
|
|
28
29
|
"lodash": "^4.17.21",
|
|
29
30
|
"next": "^14.2.5",
|
|
30
31
|
"simple-git": "^3.25.0",
|
|
31
|
-
"supabase": "^1.
|
|
32
|
+
"supabase": "^1.191.3",
|
|
32
33
|
"tsx": "^4.17.0",
|
|
33
34
|
"utf-8-validate": "^6.0.4",
|
|
34
35
|
"zod": "^3.23.8"
|
package/types/database.ts
CHANGED
|
@@ -1,254 +1,260 @@
|
|
|
1
|
-
export type Json =
|
|
2
|
-
| string
|
|
3
|
-
| number
|
|
4
|
-
| boolean
|
|
5
|
-
| null
|
|
6
|
-
| { [key: string]: Json | undefined }
|
|
7
|
-
| Json[]
|
|
8
|
-
|
|
9
|
-
export type Database = {
|
|
10
|
-
public: {
|
|
11
|
-
Tables: {
|
|
12
|
-
beatmaps: {
|
|
13
|
-
Row: {
|
|
14
|
-
beatmapHash: string
|
|
15
|
-
created_at: string
|
|
16
|
-
difficulty: number | null
|
|
17
|
-
length: number | null
|
|
18
|
-
noteCount: number | null
|
|
19
|
-
playcount: number | null
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
[_ in never]: never
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
[_ in never]: never
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
?
|
|
213
|
-
: never
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
?
|
|
234
|
-
: never
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
1
|
+
export type Json =
|
|
2
|
+
| string
|
|
3
|
+
| number
|
|
4
|
+
| boolean
|
|
5
|
+
| null
|
|
6
|
+
| { [key: string]: Json | undefined }
|
|
7
|
+
| Json[]
|
|
8
|
+
|
|
9
|
+
export type Database = {
|
|
10
|
+
public: {
|
|
11
|
+
Tables: {
|
|
12
|
+
beatmaps: {
|
|
13
|
+
Row: {
|
|
14
|
+
beatmapHash: string
|
|
15
|
+
created_at: string
|
|
16
|
+
difficulty: number | null
|
|
17
|
+
length: number | null
|
|
18
|
+
noteCount: number | null
|
|
19
|
+
playcount: number | null
|
|
20
|
+
ranked: boolean | null
|
|
21
|
+
title: string | null
|
|
22
|
+
}
|
|
23
|
+
Insert: {
|
|
24
|
+
beatmapHash: string
|
|
25
|
+
created_at?: string
|
|
26
|
+
difficulty?: number | null
|
|
27
|
+
length?: number | null
|
|
28
|
+
noteCount?: number | null
|
|
29
|
+
playcount?: number | null
|
|
30
|
+
ranked?: boolean | null
|
|
31
|
+
title?: string | null
|
|
32
|
+
}
|
|
33
|
+
Update: {
|
|
34
|
+
beatmapHash?: string
|
|
35
|
+
created_at?: string
|
|
36
|
+
difficulty?: number | null
|
|
37
|
+
length?: number | null
|
|
38
|
+
noteCount?: number | null
|
|
39
|
+
playcount?: number | null
|
|
40
|
+
ranked?: boolean | null
|
|
41
|
+
title?: string | null
|
|
42
|
+
}
|
|
43
|
+
Relationships: []
|
|
44
|
+
}
|
|
45
|
+
profiles: {
|
|
46
|
+
Row: {
|
|
47
|
+
about_me: string | null
|
|
48
|
+
avatar_url: string | null
|
|
49
|
+
badges: Json | null
|
|
50
|
+
computedUsername: string | null
|
|
51
|
+
created_at: number | null
|
|
52
|
+
flag: string | null
|
|
53
|
+
id: number
|
|
54
|
+
play_count: number | null
|
|
55
|
+
skill_points: number | null
|
|
56
|
+
squares_hit: number | null
|
|
57
|
+
total_score: number | null
|
|
58
|
+
uid: string | null
|
|
59
|
+
username: string | null
|
|
60
|
+
verified: boolean | null
|
|
61
|
+
}
|
|
62
|
+
Insert: {
|
|
63
|
+
about_me?: string | null
|
|
64
|
+
avatar_url?: string | null
|
|
65
|
+
badges?: Json | null
|
|
66
|
+
computedUsername?: string | null
|
|
67
|
+
created_at?: number | null
|
|
68
|
+
flag?: string | null
|
|
69
|
+
id?: number
|
|
70
|
+
play_count?: number | null
|
|
71
|
+
skill_points?: number | null
|
|
72
|
+
squares_hit?: number | null
|
|
73
|
+
total_score?: number | null
|
|
74
|
+
uid?: string | null
|
|
75
|
+
username?: string | null
|
|
76
|
+
verified?: boolean | null
|
|
77
|
+
}
|
|
78
|
+
Update: {
|
|
79
|
+
about_me?: string | null
|
|
80
|
+
avatar_url?: string | null
|
|
81
|
+
badges?: Json | null
|
|
82
|
+
computedUsername?: string | null
|
|
83
|
+
created_at?: number | null
|
|
84
|
+
flag?: string | null
|
|
85
|
+
id?: number
|
|
86
|
+
play_count?: number | null
|
|
87
|
+
skill_points?: number | null
|
|
88
|
+
squares_hit?: number | null
|
|
89
|
+
total_score?: number | null
|
|
90
|
+
uid?: string | null
|
|
91
|
+
username?: string | null
|
|
92
|
+
verified?: boolean | null
|
|
93
|
+
}
|
|
94
|
+
Relationships: [
|
|
95
|
+
{
|
|
96
|
+
foreignKeyName: "profiles_uid_fkey"
|
|
97
|
+
columns: ["uid"]
|
|
98
|
+
isOneToOne: true
|
|
99
|
+
referencedRelation: "users"
|
|
100
|
+
referencedColumns: ["id"]
|
|
101
|
+
},
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
scores: {
|
|
105
|
+
Row: {
|
|
106
|
+
awarded_sp: number | null
|
|
107
|
+
beatmapHash: string | null
|
|
108
|
+
created_at: string
|
|
109
|
+
id: number
|
|
110
|
+
misses: number | null
|
|
111
|
+
noteResults: Json | null
|
|
112
|
+
passed: boolean | null
|
|
113
|
+
rank: string | null
|
|
114
|
+
replayHwid: string | null
|
|
115
|
+
songId: string | null
|
|
116
|
+
triggers: Json | null
|
|
117
|
+
userId: number | null
|
|
118
|
+
}
|
|
119
|
+
Insert: {
|
|
120
|
+
awarded_sp?: number | null
|
|
121
|
+
beatmapHash?: string | null
|
|
122
|
+
created_at?: string
|
|
123
|
+
id?: number
|
|
124
|
+
misses?: number | null
|
|
125
|
+
noteResults?: Json | null
|
|
126
|
+
passed?: boolean | null
|
|
127
|
+
rank?: string | null
|
|
128
|
+
replayHwid?: string | null
|
|
129
|
+
songId?: string | null
|
|
130
|
+
triggers?: Json | null
|
|
131
|
+
userId?: number | null
|
|
132
|
+
}
|
|
133
|
+
Update: {
|
|
134
|
+
awarded_sp?: number | null
|
|
135
|
+
beatmapHash?: string | null
|
|
136
|
+
created_at?: string
|
|
137
|
+
id?: number
|
|
138
|
+
misses?: number | null
|
|
139
|
+
noteResults?: Json | null
|
|
140
|
+
passed?: boolean | null
|
|
141
|
+
rank?: string | null
|
|
142
|
+
replayHwid?: string | null
|
|
143
|
+
songId?: string | null
|
|
144
|
+
triggers?: Json | null
|
|
145
|
+
userId?: number | null
|
|
146
|
+
}
|
|
147
|
+
Relationships: [
|
|
148
|
+
{
|
|
149
|
+
foreignKeyName: "scores_beatmapHash_fkey"
|
|
150
|
+
columns: ["beatmapHash"]
|
|
151
|
+
isOneToOne: false
|
|
152
|
+
referencedRelation: "beatmaps"
|
|
153
|
+
referencedColumns: ["beatmapHash"]
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
foreignKeyName: "scores_userId_fkey"
|
|
157
|
+
columns: ["userId"]
|
|
158
|
+
isOneToOne: false
|
|
159
|
+
referencedRelation: "profiles"
|
|
160
|
+
referencedColumns: ["id"]
|
|
161
|
+
},
|
|
162
|
+
]
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
Views: {
|
|
166
|
+
[_ in never]: never
|
|
167
|
+
}
|
|
168
|
+
Functions: {
|
|
169
|
+
[_ in never]: never
|
|
170
|
+
}
|
|
171
|
+
Enums: {
|
|
172
|
+
[_ in never]: never
|
|
173
|
+
}
|
|
174
|
+
CompositeTypes: {
|
|
175
|
+
[_ in never]: never
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
type PublicSchema = Database[Extract<keyof Database, "public">]
|
|
181
|
+
|
|
182
|
+
export type Tables<
|
|
183
|
+
PublicTableNameOrOptions extends
|
|
184
|
+
| keyof (PublicSchema["Tables"] & PublicSchema["Views"])
|
|
185
|
+
| { schema: keyof Database },
|
|
186
|
+
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
187
|
+
? keyof (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
|
|
188
|
+
Database[PublicTableNameOrOptions["schema"]]["Views"])
|
|
189
|
+
: never = never,
|
|
190
|
+
> = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
191
|
+
? (Database[PublicTableNameOrOptions["schema"]]["Tables"] &
|
|
192
|
+
Database[PublicTableNameOrOptions["schema"]]["Views"])[TableName] extends {
|
|
193
|
+
Row: infer R
|
|
194
|
+
}
|
|
195
|
+
? R
|
|
196
|
+
: never
|
|
197
|
+
: PublicTableNameOrOptions extends keyof (PublicSchema["Tables"] &
|
|
198
|
+
PublicSchema["Views"])
|
|
199
|
+
? (PublicSchema["Tables"] &
|
|
200
|
+
PublicSchema["Views"])[PublicTableNameOrOptions] extends {
|
|
201
|
+
Row: infer R
|
|
202
|
+
}
|
|
203
|
+
? R
|
|
204
|
+
: never
|
|
205
|
+
: never
|
|
206
|
+
|
|
207
|
+
export type TablesInsert<
|
|
208
|
+
PublicTableNameOrOptions extends
|
|
209
|
+
| keyof PublicSchema["Tables"]
|
|
210
|
+
| { schema: keyof Database },
|
|
211
|
+
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
212
|
+
? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
|
|
213
|
+
: never = never,
|
|
214
|
+
> = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
215
|
+
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
|
216
|
+
Insert: infer I
|
|
217
|
+
}
|
|
218
|
+
? I
|
|
219
|
+
: never
|
|
220
|
+
: PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
|
|
221
|
+
? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
|
|
222
|
+
Insert: infer I
|
|
223
|
+
}
|
|
224
|
+
? I
|
|
225
|
+
: never
|
|
226
|
+
: never
|
|
227
|
+
|
|
228
|
+
export type TablesUpdate<
|
|
229
|
+
PublicTableNameOrOptions extends
|
|
230
|
+
| keyof PublicSchema["Tables"]
|
|
231
|
+
| { schema: keyof Database },
|
|
232
|
+
TableName extends PublicTableNameOrOptions extends { schema: keyof Database }
|
|
233
|
+
? keyof Database[PublicTableNameOrOptions["schema"]]["Tables"]
|
|
234
|
+
: never = never,
|
|
235
|
+
> = PublicTableNameOrOptions extends { schema: keyof Database }
|
|
236
|
+
? Database[PublicTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
|
237
|
+
Update: infer U
|
|
238
|
+
}
|
|
239
|
+
? U
|
|
240
|
+
: never
|
|
241
|
+
: PublicTableNameOrOptions extends keyof PublicSchema["Tables"]
|
|
242
|
+
? PublicSchema["Tables"][PublicTableNameOrOptions] extends {
|
|
243
|
+
Update: infer U
|
|
244
|
+
}
|
|
245
|
+
? U
|
|
246
|
+
: never
|
|
247
|
+
: never
|
|
248
|
+
|
|
249
|
+
export type Enums<
|
|
250
|
+
PublicEnumNameOrOptions extends
|
|
251
|
+
| keyof PublicSchema["Enums"]
|
|
252
|
+
| { schema: keyof Database },
|
|
253
|
+
EnumName extends PublicEnumNameOrOptions extends { schema: keyof Database }
|
|
254
|
+
? keyof Database[PublicEnumNameOrOptions["schema"]]["Enums"]
|
|
255
|
+
: never = never,
|
|
256
|
+
> = PublicEnumNameOrOptions extends { schema: keyof Database }
|
|
257
|
+
? Database[PublicEnumNameOrOptions["schema"]]["Enums"][EnumName]
|
|
258
|
+
: PublicEnumNameOrOptions extends keyof PublicSchema["Enums"]
|
|
259
|
+
? PublicSchema["Enums"][PublicEnumNameOrOptions]
|
|
260
|
+
: never
|