You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
773 B

  1. import { AnnotationApplicationService } from '../annotationApplicationService'
  2. import { TextClassificationDTO } from './textClassificationData'
  3. import { TextClassificationItem } from '~/domain/models/tasks/textClassification'
  4. export class TextClassificationApplicationService extends AnnotationApplicationService<TextClassificationItem> {
  5. public async list(projectId: string, docId: number): Promise<TextClassificationDTO[]> {
  6. const items = await this.repository.list(projectId, docId)
  7. return items.map(item => new TextClassificationDTO(item))
  8. }
  9. public async create(projectId: string, docId: number, labelId: number): Promise<void> {
  10. const item = new TextClassificationItem(0, labelId, 0)
  11. await this.repository.create(projectId, docId, item)
  12. }
  13. }