mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 20:13:49 +00:00
Update brewery post services, transactional emails
This commit is contained in:
@@ -7,6 +7,7 @@ import {
|
||||
GetAllBreweryPostsByPostedById,
|
||||
GetBreweryPostById,
|
||||
GetMapBreweryPosts,
|
||||
UpdateBreweryPost,
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
@@ -205,3 +206,36 @@ export const getMapBreweryPostsService: GetMapBreweryPosts = async ({
|
||||
const count = await DBClient.instance.breweryPost.count();
|
||||
return { breweryPosts, count };
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates a brewery post.
|
||||
*
|
||||
* @param args - The arguments to update a brewery post.
|
||||
* @param args.breweryPostId - The ID of the brewery post to update.
|
||||
* @param args.body - The body of the request.
|
||||
* @param args.body.name - The name of the brewery.
|
||||
* @param args.body.description - The description of the brewery.
|
||||
* @param args.body.dateEstablished - The date the brewery was established.
|
||||
* @returns The updated brewery post.
|
||||
*/
|
||||
export const updateBreweryPostService: UpdateBreweryPost = async ({
|
||||
breweryPostId,
|
||||
body,
|
||||
}) => {
|
||||
const breweryPost = await DBClient.instance.breweryPost.update({
|
||||
where: { id: breweryPostId },
|
||||
data: body,
|
||||
select: breweryPostSelect,
|
||||
});
|
||||
|
||||
return breweryPost as Awaited<ReturnType<typeof updateBreweryPostService>>;
|
||||
};
|
||||
|
||||
export const deleteBreweryPostService: GetBreweryPostById = async ({ breweryPostId }) => {
|
||||
const breweryPost = await DBClient.instance.breweryPost.delete({
|
||||
where: { id: breweryPostId },
|
||||
select: breweryPostSelect,
|
||||
});
|
||||
|
||||
return breweryPost as Awaited<ReturnType<typeof deleteBreweryPostService>>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user