mirror of
https://github.com/aaronpo97/the-biergarten-app.git
synced 2026-02-16 10:42:08 +00:00
update docs
This commit is contained in:
@@ -7,6 +7,14 @@ import {
|
||||
GetAllBeerPostComments,
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
* The select object for retrieving beer post comments.
|
||||
*
|
||||
* @example
|
||||
* const beerPostComments = await DBClient.instance.beerComment.findMany({
|
||||
* select: beerPostCommentSelect,
|
||||
* });
|
||||
*/
|
||||
const beerPostCommentSelect = {
|
||||
id: true,
|
||||
content: true,
|
||||
@@ -18,6 +26,17 @@ const beerPostCommentSelect = {
|
||||
},
|
||||
} 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 = ({
|
||||
body,
|
||||
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 = ({
|
||||
beerPostCommentId,
|
||||
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 = ({
|
||||
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 = ({
|
||||
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 ({
|
||||
beerPostId,
|
||||
pageNum,
|
||||
|
||||
@@ -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,
|
||||
}) => {
|
||||
|
||||
@@ -6,6 +6,14 @@ import {
|
||||
UpdateBreweryCommentById,
|
||||
} from './types';
|
||||
|
||||
/**
|
||||
* The select object for retrieving brewery comments.
|
||||
*
|
||||
* @example
|
||||
* const breweryComments = await DBClient.instance.breweryComment.findMany({
|
||||
* select: breweryCommentSelect,
|
||||
* });
|
||||
*/
|
||||
const breweryCommentSelect = {
|
||||
id: true,
|
||||
content: true,
|
||||
@@ -17,6 +25,16 @@ const breweryCommentSelect = {
|
||||
},
|
||||
} 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 = ({
|
||||
breweryCommentId,
|
||||
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 = ({
|
||||
body,
|
||||
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 ({
|
||||
id,
|
||||
pageNum,
|
||||
@@ -67,6 +105,13 @@ export const getAllBreweryComments: GetAllBreweryComments = async ({
|
||||
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 = ({
|
||||
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 = ({
|
||||
breweryCommentId,
|
||||
}) => {
|
||||
|
||||
Reference in New Issue
Block a user