feat: add i18n and avatar upload
This commit is contained in:
@@ -24,7 +24,20 @@ export const updateProfileSchema = z.object({
|
||||
.optional(),
|
||||
displayName: z.string().trim().min(1).max(64).optional(),
|
||||
bio: z.string().trim().max(500).nullable().optional(),
|
||||
avatarUrl: z.string().url().nullable().optional(),
|
||||
avatarUrl: z
|
||||
.preprocess(
|
||||
(value) => (value === '' ? null : value),
|
||||
z
|
||||
.string()
|
||||
.refine(
|
||||
(value) => value.startsWith('/uploads/avatar/') || z.string().url().safeParse(value).success,
|
||||
{
|
||||
message: 'Avatar must be a URL or an uploaded avatar path',
|
||||
},
|
||||
)
|
||||
.nullable(),
|
||||
)
|
||||
.optional(),
|
||||
});
|
||||
|
||||
export type UpdateProfileInput = z.infer<typeof updateProfileSchema>;
|
||||
|
||||
Reference in New Issue
Block a user