mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
feat: begin work on delete beer style
This commit is contained in:
24
src/services/BeerStyles/deleteBeerStyleById.ts
Normal file
24
src/services/BeerStyles/deleteBeerStyleById.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { z } from 'zod';
|
||||
import DBClient from '@/prisma/DBClient';
|
||||
import BeerStyleQueryResult from './schema/BeerStyleQueryResult';
|
||||
|
||||
const deleteBeerStyleById = async (id: string) => {
|
||||
const deleted = await DBClient.instance.beerStyle.delete({
|
||||
where: { id },
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
createdAt: true,
|
||||
updatedAt: true,
|
||||
abvRange: true,
|
||||
ibuRange: true,
|
||||
description: true,
|
||||
postedBy: { select: { id: true, username: true } },
|
||||
glassware: { select: { id: true, name: true } },
|
||||
},
|
||||
});
|
||||
|
||||
return deleted as z.infer<typeof BeerStyleQueryResult> | null;
|
||||
};
|
||||
|
||||
export default deleteBeerStyleById;
|
||||
Reference in New Issue
Block a user