Refactor: update beer post services, comment services

This commit is contained in:
Aaron William Po
2023-12-11 21:16:33 -05:00
parent 80404802dc
commit f7d09ce61e
27 changed files with 410 additions and 517 deletions

View File

@@ -11,7 +11,6 @@ import {
createBeerPostCommentService,
getAllBeerCommentsService,
deleteBeerCommentByIdService,
getBeerPostCommentCountService,
} from '@/services/comments/beer-comment';
import {
@@ -98,14 +97,12 @@ export const getAllBeerPostComments = async (
// eslint-disable-next-line @typescript-eslint/naming-convention
const { page_size, page_num } = req.query;
const comments = await getAllBeerCommentsService({
const { comments, count } = await getAllBeerCommentsService({
beerPostId,
pageNum: parseInt(page_num, 10),
pageSize: parseInt(page_size, 10),
});
const count = await getBeerPostCommentCountService({ beerPostId });
res.setHeader('X-Total-Count', count);
res.status(200).json({