mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Feat: Implement infinite scrolling brewery comment section
Refactor beer comment schemas to work on brewery comments as well. Add robots.txt to block crawling for now.
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
import DBClient from '@/prisma/DBClient';
|
||||
import beerPostQueryResult from '@/services/BeerPost/schema/BeerPostQueryResult';
|
||||
import { z } from 'zod';
|
||||
import BeerCommentQueryResult from './schema/BeerCommentQueryResult';
|
||||
import CommentQueryResult from '../types/CommentSchema/CommentQueryResult';
|
||||
|
||||
const getAllBeerComments = async (
|
||||
{ id }: Pick<z.infer<typeof beerPostQueryResult>, 'id'>,
|
||||
{ pageSize, pageNum = 0 }: { pageSize: number; pageNum?: number },
|
||||
) => {
|
||||
const skip = (pageNum - 1) * pageSize;
|
||||
const beerComments: z.infer<typeof BeerCommentQueryResult>[] =
|
||||
const beerComments: z.infer<typeof CommentQueryResult>[] =
|
||||
await DBClient.instance.beerComment.findMany({
|
||||
skip,
|
||||
take: pageSize,
|
||||
|
||||
Reference in New Issue
Block a user