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.

42 lines
1003 B

  1. import { ExampleItem, ExampleItemList } from '~/domain/models/example/example'
  2. export class ExampleDTO {
  3. id: number;
  4. text: string;
  5. meta: object;
  6. annotationApprover: boolean | null;
  7. commentCount: number;
  8. isApproved: boolean;
  9. fileUrl: string;
  10. filename: string;
  11. url: string;
  12. isConfirmed: boolean;
  13. constructor(item: ExampleItem) {
  14. this.id = item.id
  15. this.text = item.text
  16. this.meta = item.meta
  17. this.annotationApprover = item.annotationApprover
  18. this.commentCount = item.commentCount
  19. this.isApproved = !!item.annotationApprover
  20. this.fileUrl = item.fileUrl
  21. this.filename = item.filename
  22. this.url = item.url
  23. this.isConfirmed = item.isConfirmed
  24. }
  25. }
  26. export class ExampleListDTO {
  27. count: number
  28. next : string | null
  29. prev : string | null
  30. items: ExampleDTO[]
  31. constructor(item: ExampleItemList) {
  32. this.count = item.count
  33. this.next = item.next
  34. this.prev = item.prev
  35. this.items = item.items.map(_ => new ExampleDTO(_))
  36. }
  37. }