Work on brewery page, refactors

Refactor query types to explicitly use z.infer
This commit is contained in:
Aaron William Po
2023-03-31 21:13:35 -04:00
parent d8a8dad37f
commit b69dbc95b4
33 changed files with 308 additions and 243 deletions

View File

@@ -5,13 +5,14 @@ import React from 'react';
import Layout from '@/components/ui/Layout';
import withPageAuthRequired from '@/getServerSideProps/withPageAuthRequired';
import getBeerPostById from '@/services/BeerPost/getBeerPostById';
import { BeerPostQueryResult } from '@/services/BeerPost/schema/BeerPostQueryResult';
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import EditBeerPostForm from '@/components/EditBeerPostForm';
import FormPageLayout from '@/components/ui/forms/FormPageLayout';
import { BiBeer } from 'react-icons/bi';
import { z } from 'zod';
interface EditPageProps {
beerPost: BeerPostQueryResult;
beerPost: z.infer<typeof beerPostQueryResult>;
}
const EditPage: NextPage<EditPageProps> = ({ beerPost }) => {

View File

@@ -11,19 +11,20 @@ import getAllBeerComments from '@/services/BeerComment/getAllBeerComments';
import getBeerPostById from '@/services/BeerPost/getBeerPostById';
import getBeerRecommendations from '@/services/BeerPost/getBeerRecommendations';
import { BeerCommentQueryResultArrayT } from '@/services/BeerComment/schema/BeerCommentQueryResult';
import { BeerPostQueryResult } from '@/services/BeerPost/schema/BeerPostQueryResult';
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
import { BeerPost } from '@prisma/client';
import getBeerPostLikeCount from '@/services/BeerPostLike/getBeerPostLikeCount';
import getBeerCommentCount from '@/services/BeerComment/getBeerCommentCount';
import { z } from 'zod';
import BeerCommentQueryResult from '@/services/BeerComment/schema/BeerCommentQueryResult';
interface BeerPageProps {
beerPost: BeerPostQueryResult;
beerPost: z.infer<typeof beerPostQueryResult>;
beerRecommendations: (BeerPost & {
brewery: { id: string; name: string };
beerImages: { id: string; alt: string; url: string }[];
})[];
beerComments: BeerCommentQueryResultArrayT;
beerComments: z.infer<typeof BeerCommentQueryResult>[];
commentsPageCount: number;
likeCount: number;
}