mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
feat: begin work on delete beer style
This commit is contained in:
28
src/services/BeerPost/deleteBeerPostById.ts
Normal file
28
src/services/BeerPost/deleteBeerPostById.ts
Normal 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;
|
||||
Reference in New Issue
Block a user