feat: begin work on delete beer style

This commit is contained in:
Aaron William Po
2023-09-24 00:57:30 -04:00
parent cb26df286a
commit 17ec5ab459
4 changed files with 58 additions and 10 deletions

View File

@@ -0,0 +1,28 @@
import DBClient from '@/prisma/DBClient';
import { z } from 'zod';
import BeerPostQueryResult from './schema/BeerPostQueryResult';
const deleteBeerPostById = async (
id: string,
): Promise<z.infer<typeof BeerPostQueryResult> | null> => {
const deleted = await DBClient.instance.beerPost.delete({
where: { id },
select: {
id: true,
name: true,
brewery: { select: { id: true, name: true } },
description: true,
beerImages: { select: { id: true, path: true, caption: true, alt: true } },
ibu: true,
abv: true,
style: { select: { id: true, name: true, description: true } },
postedBy: { select: { id: true, username: true } },
createdAt: true,
updatedAt: true,
},
});
return deleted;
};
export default deleteBeerPostById;