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.

26 lines
1.0 KiB

  1. import { AnnotationApplicationService } from '../annotationApplicationService'
  2. import { Seq2seqDTO } from './seq2seqData'
  3. import { APISeq2seqRepository } from '~/repositories/tasks/seq2seq/apiSeq2seq'
  4. import { Seq2seqLabel } from '~/domain/models/tasks/seq2seq'
  5. export class Seq2seqApplicationService extends AnnotationApplicationService<Seq2seqLabel> {
  6. constructor(
  7. readonly repository: APISeq2seqRepository
  8. ) {
  9. super(new APISeq2seqRepository())
  10. }
  11. public async list(projectId: string, docId: number): Promise<Seq2seqDTO[]> {
  12. const items = await this.repository.list(projectId, docId)
  13. return items.map(item => new Seq2seqDTO(item))
  14. }
  15. public async create(projectId: string, docId: number, text: string): Promise<void> {
  16. const item = new Seq2seqLabel(0, text, 0)
  17. await this.repository.create(projectId, docId, item)
  18. }
  19. public async changeText(projectId: string, docId: number, annotationId: number, text: string): Promise<void> {
  20. await this.repository.update(projectId, docId, annotationId, text)
  21. }
  22. }