Add dbml, minor tweaks to beer style page

This commit is contained in:
Aaron William Po
2023-09-23 22:32:15 -04:00
parent 390ac8daf9
commit cb26df286a
8 changed files with 121 additions and 9 deletions

View File

@@ -0,0 +1,24 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import BeerStyleQueryResult from './schema/BeerStyleQueryResult';
const getBeerStyleById = async (id: string) => {
const beerStyle = (await DBClient.instance.beerStyle.findUnique({
where: { id },
select: {
id: true,
name: true,
postedBy: { select: { id: true, username: true } },
createdAt: true,
updatedAt: true,
abvRange: true,
ibuRange: true,
description: true,
glassware: { select: { id: true, name: true } },
},
})) as z.infer<typeof BeerStyleQueryResult> | null;
return beerStyle;
};
export default getBeerStyleById;