Add create beer, beer post page

This commit is contained in:
Aaron William Po
2023-01-24 21:03:31 -05:00
parent 972846f5a8
commit d0bced1376
12 changed files with 264 additions and 40 deletions

View File

@@ -32,6 +32,21 @@ const getAllBeerPosts = async (pageNum: number, pageSize: number) => {
username: true,
},
},
beerComments: {
select: {
id: true,
content: true,
createdAt: true,
postedBy: {
select: {
username: true,
id: true,
},
},
},
},
beerImages: {
select: {
url: true,

View File

@@ -6,6 +6,19 @@ const prisma = DBClient.instance;
const getBeerPostById = async (id: string) => {
const beerPost: BeerPostQueryResult | null = await prisma.beerPost.findFirst({
select: {
beerComments: {
select: {
id: true,
content: true,
createdAt: true,
postedBy: {
select: {
username: true,
id: true,
},
},
},
},
id: true,
name: true,
brewery: {

View File

@@ -22,5 +22,15 @@ export default interface BeerPostQueryResult {
username: string;
};
beerComments: {
id: string;
content: string;
createdAt: Date;
postedBy: {
id: string;
username: string;
};
}[];
createdAt: Date;
}