mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
Refactor and formatting
This commit is contained in:
@@ -2,11 +2,14 @@ import DBClient from '@/prisma/DBClient';
|
||||
import { z } from 'zod';
|
||||
import BeerStyleQueryResult from './schema/BeerStyleQueryResult';
|
||||
|
||||
const getAllBeerStyles = async (
|
||||
pageNum: number,
|
||||
pageSize: number,
|
||||
): Promise<z.infer<typeof BeerStyleQueryResult>[]> => {
|
||||
const styles = (await DBClient.instance.beerStyle.findMany({
|
||||
const getAllBeerStyles = async ({
|
||||
pageNum,
|
||||
pageSize,
|
||||
}: {
|
||||
pageNum: number;
|
||||
pageSize: number;
|
||||
}): Promise<z.infer<typeof BeerStyleQueryResult>[]> =>
|
||||
DBClient.instance.beerStyle.findMany({
|
||||
take: pageSize,
|
||||
skip: (pageNum - 1) * pageSize,
|
||||
select: {
|
||||
@@ -20,9 +23,6 @@ const getAllBeerStyles = async (
|
||||
description: true,
|
||||
glassware: { select: { id: true, name: true } },
|
||||
},
|
||||
})) as z.infer<typeof BeerStyleQueryResult>[];
|
||||
|
||||
return styles;
|
||||
};
|
||||
}) as ReturnType<typeof getAllBeerStyles>;
|
||||
|
||||
export default getAllBeerStyles;
|
||||
|
||||
Reference in New Issue
Block a user