Browse Source

Update comment repository to remove comment item list

pull/1233/head
Hironsan 4 years ago
parent
commit
28c5d6429f
2 changed files with 5 additions and 5 deletions
  1. 6
      frontend/repositories/comment/api.ts
  2. 4
      frontend/repositories/comment/interface.ts

6
frontend/repositories/comment/api.ts

@ -1,5 +1,5 @@
import ApiService from '@/services/api.service'
import { CommentItemList, CommentItem } from '@/models/comment'
import { CommentItem } from '@/models/comment'
import { CommentItemListRepository, CommentItemResponse } from './interface'
export class FromApiCommentItemListRepository implements CommentItemListRepository {
@ -14,11 +14,11 @@ export class FromApiCommentItemListRepository implements CommentItemListReposito
return items.map(item => CommentItem.valueOf(item))
}
async list(projectId: string, docId: string): Promise<CommentItemList> {
async list(projectId: string, docId: string): Promise<CommentItem[]> {
const url = `/projects/${projectId}/docs/${docId}/comments`
const response = await this.request.get(url)
const items: CommentItemResponse[] = response.data
return CommentItemList.valueOf(items.map(item => CommentItem.valueOf(item)))
return items.map(item => CommentItem.valueOf(item))
}
async create(projectId: string, docId: string, text: string): Promise<CommentItem> {

4
frontend/repositories/comment/interface.ts

@ -1,4 +1,4 @@
import { CommentItem, CommentItemList } from '@/models/comment'
import { CommentItem } from '@/models/comment'
export interface CommentItemResponse {
id: number,
@ -13,7 +13,7 @@ export interface CommentItemResponse {
export interface CommentItemListRepository {
listAll(projectId: string, q: string): Promise<CommentItem[]>
list(projectId: string, docId: string): Promise<CommentItemList>
list(projectId: string, docId: string): Promise<CommentItem[]>
create(projectId: string, docId: string, text: string): Promise<CommentItem>

Loading…
Cancel
Save