From 7a60fc51c312407a4243a2eb8f30536d8bf32e13 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 12 Mar 2021 08:48:12 +0900 Subject: [PATCH] Add clear method to the annotation repository --- frontend/repositories/tasks/text-classification/api.ts | 5 +++++ frontend/repositories/tasks/text-classification/interface.ts | 2 ++ 2 files changed, 7 insertions(+) diff --git a/frontend/repositories/tasks/text-classification/api.ts b/frontend/repositories/tasks/text-classification/api.ts index 1f811a52..26256cb5 100644 --- a/frontend/repositories/tasks/text-classification/api.ts +++ b/frontend/repositories/tasks/text-classification/api.ts @@ -25,4 +25,9 @@ export class FromApiTextClassificationRepository implements TextClassificationRe const url = `/projects/${projectId}/docs/${docId}/annotations/${annotationId}` await this.request.delete(url) } + + public async clear(projectId: string, docId: number): Promise { + const url = `/projects/${projectId}/docs/${docId}/annotations` + await this.request.delete(url) + } } diff --git a/frontend/repositories/tasks/text-classification/interface.ts b/frontend/repositories/tasks/text-classification/interface.ts index 4b3b81bd..b93cd62b 100644 --- a/frontend/repositories/tasks/text-classification/interface.ts +++ b/frontend/repositories/tasks/text-classification/interface.ts @@ -6,4 +6,6 @@ export interface TextClassificationRepository { create(projectId: string, docId: number, labelId: number): Promise delete(projectId: string, docId: number, annotationId: number): Promise + + clear(projectId: string, docId: number): Promise }