feat: implement advanced comment features including reply and like functionality
All checks were successful
Push to Helm Chart Repository / build (push) Successful in 13s

- Added support for nested comments with reply functionality.
- Implemented like/unlike feature for comments and posts.
- Enhanced comment DTO to include reply count, like count, and like status.
- Updated comment and like services to handle new functionalities.
- Created new API endpoints for toggling likes and listing comments.
- Improved UI components for comments to support replies and likes with animations.
- Added localization for new comment-related messages.
- Introduced a TODO list for future enhancements in the comment module.
This commit is contained in:
2025-09-09 00:24:25 +08:00
parent 382132f550
commit dd7641bf6e
28 changed files with 422 additions and 101 deletions

View File

@ -32,6 +32,7 @@ export interface ListCommentsParams {
desc?: boolean
page?: number
size?: number
commentId?: number
}
export async function listComments(params: ListCommentsParams): Promise<BaseResponse<Comment[]>> {
@ -43,6 +44,7 @@ export async function listComments(params: ListCommentsParams): Promise<BaseResp
desc = true,
page = 1,
size = 10,
commentId = 0,
} = params
const res = await axiosClient.get<BaseResponse<Comment[]>>(`/comment/list`, {
params: {
@ -52,7 +54,8 @@ export async function listComments(params: ListCommentsParams): Promise<BaseResp
orderBy,
desc,
page,
size
size,
commentId,
}
})
return res.data

11
web/src/api/like.ts Normal file
View File

@ -0,0 +1,11 @@
import axiosClient from './client'
import type { BaseResponse } from '@/models/resp'
import { TargetType } from '@/models/types'
export async function toggleLike(
{ targetType, targetId }: { targetType: TargetType, targetId: number },
): Promise<BaseResponse<{ status: boolean }>> {
const res = await axiosClient.put<BaseResponse<{ status: boolean }>>('/like/toggle', { targetType, targetId })
return res.data
}