update docs

This commit is contained in:
Aaron William Po
2023-12-11 22:39:31 -05:00
parent f7d09ce61e
commit 685c86e0c1
3 changed files with 156 additions and 0 deletions

View File

@@ -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,
}) => {