mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
30 lines
642 B
TypeScript
30 lines
642 B
TypeScript
import DBClient from '@/prisma/DBClient';
|
|
import GetAllBreweryPostsQueryResult from './types/BreweryPostQueryResult';
|
|
|
|
const prisma = DBClient.instance;
|
|
|
|
const getBreweryPostById = async (id: string) => {
|
|
const breweryPost: GetAllBreweryPostsQueryResult | null =
|
|
await prisma.breweryPost.findFirst({
|
|
select: {
|
|
id: true,
|
|
location: true,
|
|
name: true,
|
|
postedBy: {
|
|
select: {
|
|
firstName: true,
|
|
lastName: true,
|
|
id: true,
|
|
},
|
|
},
|
|
},
|
|
where: {
|
|
id,
|
|
},
|
|
});
|
|
|
|
return breweryPost;
|
|
};
|
|
|
|
export default getBreweryPostById;
|