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.

40 lines
939 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. constructor(item: ExampleItem) {
  13. this.id = item.id
  14. this.text = item.text
  15. this.meta = item.meta
  16. this.annotationApprover = item.annotationApprover
  17. this.commentCount = item.commentCount
  18. this.isApproved = !!item.annotationApprover
  19. this.fileUrl = item.fileUrl
  20. this.filename = item.filename
  21. this.url = item.url
  22. }
  23. }
  24. export class ExampleListDTO {
  25. count: number
  26. next : string | null
  27. prev : string | null
  28. items: ExampleDTO[]
  29. constructor(item: ExampleItemList) {
  30. this.count = item.count
  31. this.next = item.next
  32. this.prev = item.prev
  33. this.items = item.items.map(_ => new ExampleDTO(_))
  34. }
  35. }