Formatting changes

This commit is contained in:
Aaron William Po
2023-02-20 09:09:45 -05:00
parent d50ce7497b
commit 4cd2ab476f
14 changed files with 61 additions and 109 deletions

View File

@@ -10,36 +10,14 @@ const getAllBeerPosts = async (pageNum: number, pageSize: number) => {
select: {
id: true,
name: true,
type: {
select: {
name: true,
id: true,
},
},
ibu: true,
abv: true,
brewery: {
select: {
name: true,
id: true,
},
},
description: true,
createdAt: true,
postedBy: {
select: {
id: true,
username: true,
},
},
beerImages: {
select: {
path: true,
caption: true,
id: true,
alt: true,
},
},
type: { select: { name: true, id: true } },
brewery: { select: { name: true, id: true } },
postedBy: { select: { id: true, username: true } },
beerImages: { select: { path: true, caption: true, id: true, alt: true } },
},
take: pageSize,
skip,

View File

@@ -6,56 +6,18 @@ 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,
},
},
rating: true,
},
},
id: true,
name: true,
brewery: {
select: {
name: true,
id: true,
},
},
ibu: true,
abv: true,
type: {
select: {
name: true,
id: true,
},
},
beerImages: {
select: {
alt: true,
path: true,
caption: true,
id: true,
},
},
createdAt: true,
description: true,
postedBy: {
select: {
username: true,
id: true,
},
},
},
where: {
id,
postedBy: { select: { username: true, id: true } },
brewery: { select: { name: true, id: true } },
type: { select: { name: true, id: true } },
beerImages: { select: { alt: true, path: true, caption: true, id: true } },
},
where: { id },
});
return beerPost;