mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 18:52:06 +00:00
update docs
This commit is contained in:
@@ -6,6 +6,14 @@ import {
|
||||
FindOrDeleteBeerStyleCommentById,
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
* The select object for retrieving beer style comments.
|
||||
*
|
||||
* @example
|
||||
* const beerStyleComments = await DBClient.instance.beerStyleComment.findMany({
|
||||
* select: beerStyleCommentSelect,
|
||||
* });
|
||||
*/
|
||||
const beerStyleCommentSelect = {
|
||||
id: true,
|
||||
content: true,
|
||||
@@ -17,6 +25,17 @@ const beerStyleCommentSelect = {
|
||||
},
|
||||
} as const;
|
||||
|
||||
/**
|
||||
* Creates a new comment for a beer style.
|
||||
*
|
||||
* @param params - The options for creating the comment.
|
||||
* @param params.body - The body of the comment.
|
||||
* @param params.body.content - The content of the comment.
|
||||
* @param params.body.rating - The rating of the beer style.
|
||||
* @param params.beerStyleId - The ID of the beer style.
|
||||
* @param params.userId - The ID of the user creating the comment.
|
||||
* @returns A promise that resolves to the created beer comment.
|
||||
*/
|
||||
export const createNewBeerStyleComment: CreateNewBeerStyleComment = ({
|
||||
body,
|
||||
userId,
|
||||
@@ -34,6 +53,15 @@ export const createNewBeerStyleComment: CreateNewBeerStyleComment = ({
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Gets all comments for a beer style.
|
||||
*
|
||||
* @param params - The options for getting the comments.
|
||||
* @param params.beerStyleId - The ID of the beer style.
|
||||
* @param params.pageNum - The page number of the comments.
|
||||
* @param params.pageSize - The page size of the comments.
|
||||
* @returns A promise that resolves to the beer style comments.
|
||||
*/
|
||||
export const getAllBeerStyleComments: GetAllBeerStyleComments = async ({
|
||||
beerStyleId,
|
||||
pageNum,
|
||||
@@ -54,6 +82,16 @@ export const getAllBeerStyleComments: GetAllBeerStyleComments = async ({
|
||||
return { comments, count };
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates a beer style comment by ID.
|
||||
*
|
||||
* @param params - The options for updating the comment.
|
||||
* @param params.body - The body of the comment.
|
||||
* @param params.body.content - The content of the comment.
|
||||
* @param params.body.rating - The rating of the beer style.
|
||||
* @param params.beerStyleCommentId - The ID of the beer style comment.
|
||||
* @returns A promise that resolves to the updated beer comment.
|
||||
*/
|
||||
export const updateBeerStyleCommentById: UpdateBeerStyleCommentById = ({
|
||||
body,
|
||||
beerStyleCommentId,
|
||||
@@ -67,6 +105,13 @@ export const updateBeerStyleCommentById: UpdateBeerStyleCommentById = ({
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Finds a comment for a beer style by ID.
|
||||
*
|
||||
* @param params - The options for finding the comment.
|
||||
* @param params.beerStyleCommentId - The ID of the beer style comment.
|
||||
* @returns A promise that resolves to the found beer comment.
|
||||
*/
|
||||
export const findBeerStyleCommentById: FindOrDeleteBeerStyleCommentById = ({
|
||||
beerStyleCommentId,
|
||||
}) => {
|
||||
@@ -76,6 +121,13 @@ export const findBeerStyleCommentById: FindOrDeleteBeerStyleCommentById = ({
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Deletes a comment for a beer style by ID.
|
||||
*
|
||||
* @param params - The options for deleting the comment.
|
||||
* @param params.beerStyleCommentId - The ID of the beer style comment.
|
||||
* @returns A promise that resolves to the deleted beer comment.
|
||||
*/
|
||||
export const deleteBeerStyleCommentById: FindOrDeleteBeerStyleCommentById = ({
|
||||
beerStyleCommentId,
|
||||
}) => {
|
||||
|
||||
Reference in New Issue
Block a user