mirror of
https://github.com/hex248/sprint.git
synced 2026-02-07 18:23:03 +00:00
avatarURL should be nullable AND optional
This commit is contained in:
@@ -2,7 +2,12 @@ import { type IconStyle, User, type UserRecord } from "@sprint/shared";
|
|||||||
import { eq } from "drizzle-orm";
|
import { eq } from "drizzle-orm";
|
||||||
import { db } from "../client";
|
import { db } from "../client";
|
||||||
|
|
||||||
export async function createUser(name: string, username: string, passwordHash: string, avatarURL?: string) {
|
export async function createUser(
|
||||||
|
name: string,
|
||||||
|
username: string,
|
||||||
|
passwordHash: string,
|
||||||
|
avatarURL?: string | null,
|
||||||
|
) {
|
||||||
const [user] = await db.insert(User).values({ name, username, passwordHash, avatarURL }).returning();
|
const [user] = await db.insert(User).values({ name, username, passwordHash, avatarURL }).returning();
|
||||||
return user;
|
return user;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const RegisterRequestSchema = z.object({
|
|||||||
.regex(/[A-Z]/, "Password must contain an uppercase letter")
|
.regex(/[A-Z]/, "Password must contain an uppercase letter")
|
||||||
.regex(/[a-z]/, "Password must contain a lowercase letter")
|
.regex(/[a-z]/, "Password must contain a lowercase letter")
|
||||||
.regex(/[0-9]/, "Password must contain a number"),
|
.regex(/[0-9]/, "Password must contain a number"),
|
||||||
avatarURL: z.string().url().nullable(),
|
avatarURL: z.string().url().nullable().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
export type RegisterRequest = z.infer<typeof RegisterRequestSchema>;
|
export type RegisterRequest = z.infer<typeof RegisterRequestSchema>;
|
||||||
|
|||||||
Reference in New Issue
Block a user