Add beer post, brewery post GET service and page

Add prettier, eslint config
This commit is contained in:
Aaron William Po
2023-01-22 20:56:33 -05:00
parent a434e1bb98
commit 0065525f5c
29 changed files with 8696 additions and 6977 deletions

View File

@@ -0,0 +1,33 @@
import DBClient from '@/prisma/client';
import BeerPostQueryResult from './types/BeerPostQueryResult';
const prisma = DBClient.instance;
const getBeerPostById = async (id: string) => {
const beerPost: BeerPostQueryResult | null = await prisma.beerPost.findFirst({
select: {
id: true,
name: true,
brewery: {
select: {
name: true,
id: true,
},
},
postedBy: {
select: {
firstName: true,
lastName: true,
id: true,
},
},
},
where: {
id,
},
});
return beerPost;
};
export default getBeerPostById;