mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
29 lines
592 B
TypeScript
29 lines
592 B
TypeScript
import DBClient from '@/prisma/DBClient';
|
|
import BreweryPostQueryResult from './types/BreweryPostQueryResult';
|
|
|
|
const prisma = DBClient.instance;
|
|
|
|
const getBreweryPostById = async (id: string) => {
|
|
const breweryPost: BreweryPostQueryResult | 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;
|