This commit is contained in:
16
src/lib/server/osu-profile.ts
Normal file
16
src/lib/server/osu-profile.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { z } from 'zod';
|
||||
const profileSchema = z.object({
|
||||
id: z.number().int().positive(),
|
||||
username: z.string().min(1),
|
||||
avatar_url: z.string().url()
|
||||
});
|
||||
export function osuProfile(value: unknown) {
|
||||
const profile = profileSchema.parse(value);
|
||||
return {
|
||||
id: String(profile.id),
|
||||
name: profile.username,
|
||||
image: profile.avatar_url,
|
||||
email: `${profile.id}@osu.invalid`,
|
||||
emailVerified: false
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user