Refactor: further extract controller logic from routers

This commit is contained in:
Aaron William Po
2023-12-04 00:59:13 -05:00
parent da8d5806bc
commit 4b2ce394c1
28 changed files with 325 additions and 308 deletions

View File

@@ -7,7 +7,7 @@ import { NextApiResponse } from 'next';
import { createRouter } from 'next-connect';
import { z } from 'zod';
import { checkIfLiked } from '@/controllers/beerPostLikes';
import { checkIfBeerPostIsLiked } from '@/controllers/likes/beerPostLikes';
const router = createRouter<
UserExtendedNextApiRequest,
@@ -17,7 +17,7 @@ const router = createRouter<
router.get(
getCurrentUser,
validateRequest({ querySchema: z.object({ id: z.string().cuid() }) }),
checkIfLiked,
checkIfBeerPostIsLiked,
);
const handler = router.handler(NextConnectOptions);