feat(#21): Replaced chat comment component with proper cursor-based commenting
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
import { CommentApi, Configuration, type CommentDto, type CreateCommentDto, type PagedCommentDto } from '~~/.api-client'
|
||||
import {
|
||||
CommentApi,
|
||||
Configuration,
|
||||
type ApplicationFormCommentCountsDto,
|
||||
type CommentDto,
|
||||
type CreateCommentDto,
|
||||
type CursorPagedCommentDto
|
||||
} from '~~/.api-client'
|
||||
import { cleanDoubleSlashes, withoutTrailingSlash } from 'ufo'
|
||||
import { wrappedFetchWrap } from '~/utils/wrappedFetch'
|
||||
|
||||
@@ -22,8 +29,24 @@ export function useCommentApi() {
|
||||
return commentApiClient.createComment({ applicationFormId, formElementId, createCommentDto })
|
||||
}
|
||||
|
||||
async function getCommentsByApplicationFormId(applicationFormId: string): Promise<PagedCommentDto> {
|
||||
return commentApiClient.getCommentsByApplicationFormId({ applicationFormId })
|
||||
async function getCommentsByApplicationFormId(
|
||||
applicationFormId: string,
|
||||
formElementId?: string,
|
||||
cursorCreatedAt?: Date,
|
||||
limit: number = 10
|
||||
): Promise<CursorPagedCommentDto> {
|
||||
return commentApiClient.getCommentsByApplicationFormId({
|
||||
applicationFormId,
|
||||
formElementId,
|
||||
cursorCreatedAt,
|
||||
limit
|
||||
})
|
||||
}
|
||||
|
||||
async function getGroupedCommentCountByApplicationFromId(
|
||||
applicationFormId: string
|
||||
): Promise<ApplicationFormCommentCountsDto> {
|
||||
return commentApiClient.getGroupedCommentCountByApplicationFromId({ applicationFormId })
|
||||
}
|
||||
|
||||
async function updateComment(id: string, commentDto: CommentDto): Promise<CommentDto> {
|
||||
@@ -37,6 +60,7 @@ export function useCommentApi() {
|
||||
return {
|
||||
createComment,
|
||||
getCommentsByApplicationFormId,
|
||||
getGroupedCommentCountByApplicationFromId,
|
||||
updateComment,
|
||||
deleteCommentById
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user