Did more work to beer post page, seed

Worked on comments and beer recs features. Fine tuning database seed amounts.
This commit is contained in:
Aaron William Po
2023-01-29 21:53:05 -05:00
parent fe277d5964
commit 0b96c8f1f5
38 changed files with 833 additions and 221 deletions

View File

@@ -0,0 +1,31 @@
import BeerPostQueryResult from '@/services/BeerPost/types/BeerPostQueryResult';
import DBClient from '@/prisma/DBClient';
const getBeerRecommendations = async (
beerPost: Pick<BeerPostQueryResult, 'type' | 'brewery'>,
) => {
const beerRecommendations = await DBClient.instance.beerPost.findMany({
where: {
OR: [
{
typeId: beerPost.type.id,
},
{
breweryId: beerPost.brewery.id,
},
],
},
include: {
beerImages: {
select: { id: true, url: true, alt: true },
},
brewery: {
select: { id: true, name: true },
},
},
});
return beerRecommendations;
};
export default getBeerRecommendations;