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

@@ -7,6 +7,14 @@ import {
GetAllBeerPostComments, GetAllBeerPostComments,
} from './types'; } from './types';
/**
* The select object for retrieving beer post comments.
*
* @example
* const beerPostComments = await DBClient.instance.beerComment.findMany({
* select: beerPostCommentSelect,
* });
*/
const beerPostCommentSelect = { const beerPostCommentSelect = {
id: true, id: true,
content: true, content: true,
@@ -18,6 +26,17 @@ const beerPostCommentSelect = {
}, },
} as const; } as const;
/**
* Creates a new comment for a beer post.
*
* @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.
* @param params.beerPostId - The ID of the beer post.
* @param params.userId - The ID of the user creating the comment.
* @returns A promise that resolves to the created beer comment.
*/
export const createBeerPostCommentService: CreateBeerPostComment = ({ export const createBeerPostCommentService: CreateBeerPostComment = ({
body, body,
beerPostId, beerPostId,
@@ -35,6 +54,16 @@ export const createBeerPostCommentService: CreateBeerPostComment = ({
}); });
}; };
/**
* Edits a comment for a beer post.
*
* @param params - The options for editing 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.
* @param params.beerPostCommentId - The ID of the beer post comment.
* @returns A promise that resolves to the updated beer comment.
*/
export const editBeerPostCommentByIdService: EditBeerPostCommentById = ({ export const editBeerPostCommentByIdService: EditBeerPostCommentById = ({
beerPostCommentId, beerPostCommentId,
body, body,
@@ -47,6 +76,13 @@ export const editBeerPostCommentByIdService: EditBeerPostCommentById = ({
}); });
}; };
/**
* Finds a comment for a beer post by ID.
*
* @param params - The options for finding the comment.
* @param params.beerPostCommentId - The ID of the beer post comment.
* @returns A promise that resolves to the found beer comment.
*/
export const getBeerPostCommentByIdService: FindOrDeleteBeerPostCommentById = ({ export const getBeerPostCommentByIdService: FindOrDeleteBeerPostCommentById = ({
beerPostCommentId, beerPostCommentId,
}) => { }) => {
@@ -56,6 +92,13 @@ export const getBeerPostCommentByIdService: FindOrDeleteBeerPostCommentById = ({
}); });
}; };
/**
* Deletes a comment for a beer post by ID.
*
* @param params - The options for deleting the comment.
* @param params.beerPostCommentId - The ID of the beer post comment.
* @returns A promise that resolves to the deleted beer comment.
*/
export const deleteBeerCommentByIdService: FindOrDeleteBeerPostCommentById = ({ export const deleteBeerCommentByIdService: FindOrDeleteBeerPostCommentById = ({
beerPostCommentId, beerPostCommentId,
}) => { }) => {
@@ -65,6 +108,15 @@ export const deleteBeerCommentByIdService: FindOrDeleteBeerPostCommentById = ({
}); });
}; };
/**
* Gets all comments for a beer post.
*
* @param params - The options for getting the comments.
* @param params.beerPostId - The ID of the beer post.
* @param params.pageNum - The page number of the comments.
* @param params.pageSize - The number of comments per page.
* @returns A promise that resolves to the found beer comments.
*/
export const getAllBeerCommentsService: GetAllBeerPostComments = async ({ export const getAllBeerCommentsService: GetAllBeerPostComments = async ({
beerPostId, beerPostId,
pageNum, pageNum,

View File

@@ -6,6 +6,14 @@ import {
FindOrDeleteBeerStyleCommentById, FindOrDeleteBeerStyleCommentById,
} from './types'; } from './types';
/**
* The select object for retrieving beer style comments.
*
* @example
* const beerStyleComments = await DBClient.instance.beerStyleComment.findMany({
* select: beerStyleCommentSelect,
* });
*/
const beerStyleCommentSelect = { const beerStyleCommentSelect = {
id: true, id: true,
content: true, content: true,
@@ -17,6 +25,17 @@ const beerStyleCommentSelect = {
}, },
} as const; } 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 = ({ export const createNewBeerStyleComment: CreateNewBeerStyleComment = ({
body, body,
userId, 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 ({ export const getAllBeerStyleComments: GetAllBeerStyleComments = async ({
beerStyleId, beerStyleId,
pageNum, pageNum,
@@ -54,6 +82,16 @@ export const getAllBeerStyleComments: GetAllBeerStyleComments = async ({
return { comments, count }; 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 = ({ export const updateBeerStyleCommentById: UpdateBeerStyleCommentById = ({
body, body,
beerStyleCommentId, 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 = ({ export const findBeerStyleCommentById: FindOrDeleteBeerStyleCommentById = ({
beerStyleCommentId, 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 = ({ export const deleteBeerStyleCommentById: FindOrDeleteBeerStyleCommentById = ({
beerStyleCommentId, beerStyleCommentId,
}) => { }) => {

View File

@@ -6,6 +6,14 @@ import {
UpdateBreweryCommentById, UpdateBreweryCommentById,
} from './types'; } from './types';
/**
* The select object for retrieving brewery comments.
*
* @example
* const breweryComments = await DBClient.instance.breweryComment.findMany({
* select: breweryCommentSelect,
* });
*/
const breweryCommentSelect = { const breweryCommentSelect = {
id: true, id: true,
content: true, content: true,
@@ -17,6 +25,16 @@ const breweryCommentSelect = {
}, },
} as const; } as const;
/**
* Updates a brewery comment by ID.
*
* @param params - The options for updating the brewery comment.
* @param params.breweryCommentId - The ID of the brewery 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 brewery.
* @returns A promise that resolves to the updated brewery comment.
*/
export const updateBreweryCommentById: UpdateBreweryCommentById = ({ export const updateBreweryCommentById: UpdateBreweryCommentById = ({
breweryCommentId, breweryCommentId,
body, body,
@@ -30,6 +48,17 @@ export const updateBreweryCommentById: UpdateBreweryCommentById = ({
}); });
}; };
/**
* Creates a new comment for a brewery.
*
* @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 brewery.
* @param params.breweryPostId - The ID of the brewery post.
* @param params.userId - The ID of the user creating the comment.
* @returns A promise that resolves to the created brewery comment.
*/
export const createNewBreweryComment: CreateNewBreweryComment = ({ export const createNewBreweryComment: CreateNewBreweryComment = ({
body, body,
breweryPostId, breweryPostId,
@@ -47,6 +76,15 @@ export const createNewBreweryComment: CreateNewBreweryComment = ({
}); });
}; };
/**
* Gets all comments for a brewery.
*
* @param params - The options for getting the comments.
* @param params.breweryPostId - The ID of the brewery post.
* @param params.pageNum - The page number of the comments.
* @param params.pageSize - The number of comments per page.
* @returns A promise that resolves to the retrieved brewery comments.
*/
export const getAllBreweryComments: GetAllBreweryComments = async ({ export const getAllBreweryComments: GetAllBreweryComments = async ({
id, id,
pageNum, pageNum,
@@ -67,6 +105,13 @@ export const getAllBreweryComments: GetAllBreweryComments = async ({
return { comments, count }; return { comments, count };
}; };
/**
* Finds a comment for a brewery post by ID.
*
* @param params - The options for finding the comment.
* @param params.breweryCommentId - The ID of the brewery post comment.
* @returns A promise that resolves to the found brewery comment.
*/
export const getBreweryCommentById: FindDeleteBreweryCommentById = ({ export const getBreweryCommentById: FindDeleteBreweryCommentById = ({
breweryCommentId, breweryCommentId,
}) => { }) => {
@@ -76,6 +121,13 @@ export const getBreweryCommentById: FindDeleteBreweryCommentById = ({
}); });
}; };
/**
* Deletes a comment for a brewery post by ID.
*
* @param params - The options for deleting the comment.
* @param params.breweryCommentId - The ID of the brewery post comment.
* @returns A promise that resolves to the deleted brewery comment.
*/
export const deleteBreweryCommentByIdService: FindDeleteBreweryCommentById = ({ export const deleteBreweryCommentByIdService: FindDeleteBreweryCommentById = ({
breweryCommentId, breweryCommentId,
}) => { }) => {