From 06f09c3f370776c8a1ab7cd38d1b5eaa851f8fdb Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 12 Mar 2021 10:27:31 +0900 Subject: [PATCH] Add approve method to document service --- .../services/application/document.service.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/frontend/services/application/document.service.ts b/frontend/services/application/document.service.ts index 27dad8ff..d500af52 100644 --- a/frontend/services/application/document.service.ts +++ b/frontend/services/application/document.service.ts @@ -7,6 +7,7 @@ export class DocumentDTO { meta : string annotationApprover: boolean | null commentCount : number + isApproved : boolean constructor(item: DocumentItem) { this.id = item.id @@ -14,6 +15,7 @@ export class DocumentDTO { this.meta = item.meta this.annotationApprover = item.annotationApprover this.commentCount = item.commentCount + this.isApproved = !!item.annotationApprover } } @@ -46,6 +48,18 @@ export class DocumentApplicationService { } } + public async fetchOne(projectId: string, page: string, q: string, isChecked: string, filterName: string): Promise { + const offset = (parseInt(page, 10) - 1).toString() + const options: SearchOption = { + limit: '1', + offset, + q, + isChecked, + filterName + } + return await this.list(projectId, options) + } + public async create(projectId: string, item: DocumentDTO): Promise { try { const doc = this.toModel(item) @@ -89,6 +103,10 @@ export class DocumentApplicationService { const response = await this.repository.uploadFile(projectId, formData) } + public async approve(projectId: string, docId: number, approved: boolean): Promise { + await this.repository.approve(projectId, docId, approved) + } + private toModel(item: DocumentDTO): DocumentItem { return new DocumentItem( item.id,