Browse Source

Add approve method to document service

pull/1251/head
Hironsan 4 years ago
parent
commit
06f09c3f37
1 changed files with 18 additions and 0 deletions
  1. 18
      frontend/services/application/document.service.ts

18
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<DocumentListDTO> {
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<DocumentDTO> {
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<void> {
await this.repository.approve(projectId, docId, approved)
}
private toModel(item: DocumentDTO): DocumentItem {
return new DocumentItem(
item.id,

Loading…
Cancel
Save