fix update-avatar

This commit is contained in:
Aaron William Po
2023-12-07 21:12:17 -05:00
parent c7d5c65ffb
commit 01a9bfaf4e
3 changed files with 4 additions and 46 deletions

View File

@@ -0,0 +1,25 @@
import getCurrentUser from '@/config/nextConnect/middleware/getCurrentUser';
import validateRequest from '@/config/nextConnect/middleware/validateRequest';
import { checkIfUserCanUpdateProfile, updateProfile } from '@/controllers/users/profile';
import { UpdateProfileRequest } from '@/controllers/users/profile/types';
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
import { NextApiResponse } from 'next';
import { createRouter } from 'next-connect';
import { z } from 'zod';
const router = createRouter<
UpdateProfileRequest,
NextApiResponse<z.infer<typeof APIResponseValidationSchema>>
>();
router.put(
getCurrentUser,
checkIfUserCanUpdateProfile,
validateRequest({ bodySchema: z.object({ bio: z.string().max(1000) }) }),
updateProfile,
);
const handler = router.handler();
export default handler;