Files
the-biergarten-app/services/BreweryPost/getAllBreweryPosts.ts
Aaron William Po 0065525f5c Add beer post, brewery post GET service and page
Add prettier, eslint config
2023-01-22 20:56:33 -05:00

22 lines
529 B
TypeScript

import DBClient from '@/prisma/client';
import GetAllBreweryPostsQueryResult from './types/BreweryPostQueryResult';
const prisma = DBClient.instance;
const getAllBreweryPosts = async () => {
const breweryPosts: GetAllBreweryPostsQueryResult[] = await prisma.breweryPost.findMany(
{
select: {
id: true,
location: true,
name: true,
postedBy: { select: { firstName: true, lastName: true, id: true } },
},
},
);
return breweryPosts;
};
export default getAllBreweryPosts;