mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
BeerPostQueryResult type now inferred from zod schema
This commit is contained in:
@@ -2,7 +2,7 @@ import { UserExtendedNextApiRequest } from '@/config/auth/types';
|
||||
import validateRequest from '@/config/nextConnect/middleware/validateRequest';
|
||||
import { createRouter } from 'next-connect';
|
||||
import createNewBeerPost from '@/services/BeerPost/createNewBeerPost';
|
||||
import BeerPostValidationSchema from '@/services/BeerPost/schema/CreateBeerPostValidationSchema';
|
||||
import CreateBeerPostValidationSchema from '@/services/BeerPost/schema/CreateBeerPostValidationSchema';
|
||||
import APIResponseValidationSchema from '@/validation/APIResponseValidationSchema';
|
||||
import { NextApiResponse } from 'next';
|
||||
import { z } from 'zod';
|
||||
@@ -10,7 +10,7 @@ import NextConnectOptions from '@/config/nextConnect/NextConnectOptions';
|
||||
import getCurrentUser from '@/config/nextConnect/middleware/getCurrentUser';
|
||||
|
||||
interface CreateBeerPostRequest extends UserExtendedNextApiRequest {
|
||||
body: z.infer<typeof BeerPostValidationSchema>;
|
||||
body: z.infer<typeof CreateBeerPostValidationSchema>;
|
||||
}
|
||||
|
||||
const createBeerPost = async (
|
||||
@@ -43,7 +43,7 @@ const router = createRouter<
|
||||
>();
|
||||
|
||||
router.post(
|
||||
validateRequest({ bodySchema: BeerPostValidationSchema }),
|
||||
validateRequest({ bodySchema: CreateBeerPostValidationSchema }),
|
||||
getCurrentUser,
|
||||
createBeerPost,
|
||||
);
|
||||
|
||||
@@ -9,7 +9,7 @@ import getAllBeerComments from '@/services/BeerComment/getAllBeerComments';
|
||||
import { BeerCommentQueryResultArrayT } from '@/services/BeerComment/schema/BeerCommentQueryResult';
|
||||
import getBeerPostById from '@/services/BeerPost/getBeerPostById';
|
||||
import getBeerRecommendations from '@/services/BeerPost/getBeerRecommendations';
|
||||
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import { BeerPostQueryResult } from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import { BeerPost } from '@prisma/client';
|
||||
import { NextPage, GetServerSideProps } from 'next';
|
||||
import Head from 'next/head';
|
||||
|
||||
@@ -6,7 +6,7 @@ import DBClient from '@/prisma/DBClient';
|
||||
import Layout from '@/components/ui/Layout';
|
||||
import Pagination from '@/components/BeerIndex/Pagination';
|
||||
import BeerCard from '@/components/BeerIndex/BeerCard';
|
||||
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import { BeerPostQueryResult } from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import Head from 'next/head';
|
||||
|
||||
interface BeerPageProps {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import BeerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import { BeerPostQueryResult } from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import getBreweryPostById from '@/services/BreweryPost/getBreweryPostById';
|
||||
import { GetServerSideProps, NextPage } from 'next';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user