Restructure account api routes, fix update profile

This commit is contained in:
Aaron William Po
2023-12-02 22:42:07 -05:00
parent 0d23b02957
commit cf89dc92df
15 changed files with 366 additions and 103 deletions

View File

@@ -1,14 +1,14 @@
import { z } from 'zod';
const UpdateProfileSchema = z.object({
bio: z.string().min(1, 'Bio cannot be empty'),
bio: z.string(),
userAvatar: z
.instanceof(typeof FileList !== 'undefined' ? FileList : Object)
.refine((fileList) => fileList instanceof FileList, {
message: 'You must submit this form in a web browser.',
})
.refine((fileList) => [...(fileList as FileList)].length === 1, {
message: 'You must upload one file.',
.refine((fileList) => [...(fileList as FileList)].length <= 1, {
message: 'You must upload only one or zero files.',
})
.refine(
(fileList) =>