Browse Source

Change the signature of CommentRepository

pull/1649/head
Hironsan 2 years ago
parent
commit
c5da8ec3a7
4 changed files with 10 additions and 10 deletions
  1. 4
      frontend/components/tasks/toolbar/forms/FormComment.vue
  2. 4
      frontend/domain/models/comment/commentRepository.ts
  3. 4
      frontend/repositories/comment/apiCommentRepository.ts
  4. 8
      frontend/services/application/comment/commentApplicationService.ts

4
frontend/components/tasks/toolbar/forms/FormComment.vue

@ -73,11 +73,11 @@ export default Vue.extend({
this.list()
},
async remove(item: CommentReadDTO) {
await this.$services.comment.delete(this.$route.params.id, this.docId, item)
await this.$services.comment.delete(this.$route.params.id, item)
this.list()
},
async maybeUpdate(item: CommentReadDTO) {
await this.$services.comment.update(this.$route.params.id, this.docId, item)
await this.$services.comment.update(this.$route.params.id, item)
this.list()
}
}

4
frontend/domain/models/comment/commentRepository.ts

@ -9,9 +9,9 @@ export interface CommentRepository {
create(projectId: string, docId: number, text: string): Promise<CommentItem>
update(projectId: string, docId: number, item: CommentItem): Promise<CommentItem>
update(projectId: string, item: CommentItem): Promise<CommentItem>
delete(projectId: string, docId: number, commentId: number): Promise<void>
delete(projectId: string, commentId: number): Promise<void>
deleteBulk(projectId: string, items: number[]): Promise<void>
}

4
frontend/repositories/comment/apiCommentRepository.ts

@ -27,13 +27,13 @@ export class APICommentRepository implements CommentRepository {
return plainToInstance(CommentItem, response.data)
}
async update(projectId: string, exampleId: number, item: CommentItem): Promise<CommentItem> {
async update(projectId: string, item: CommentItem): Promise<CommentItem> {
const url = `/projects/${projectId}/comments/${item.id}`
const response = await this.request.put(url, item.toObject())
return plainToInstance(CommentItem, response.data)
}
async delete(projectId: string, exampleId: number, commentId: number): Promise<void> {
async delete(projectId: string, commentId: number): Promise<void> {
const url = `/projects/${projectId}/comments/${commentId}`
const response = await this.request.delete(url)
}

8
frontend/services/application/comment/commentApplicationService.ts

@ -22,13 +22,13 @@ export class CommentApplicationService {
return this.repository.create(projectId, docId, text)
}
public update(projectId: string, docId: number, item: CommentReadDTO): Promise<CommentItem> {
public update(projectId: string, item: CommentReadDTO): Promise<CommentItem> {
const comment = plainToInstance(CommentItem, item)
return this.repository.update(projectId, docId, comment)
return this.repository.update(projectId, comment)
}
public delete(projectId: string, docId: number, item: CommentReadDTO): Promise<void> {
return this.repository.delete(projectId, docId, item.id)
public delete(projectId: string, item: CommentReadDTO): Promise<void> {
return this.repository.delete(projectId, item.id)
}
public deleteBulk(projectId: string, items: CommentReadDTO[]): Promise<void> {

Loading…
Cancel
Save