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.

34 lines
811 B

  1. import { DocumentItem, DocumentItemList } from '~/domain/models/document/document'
  2. export class DocumentDTO {
  3. id: number;
  4. text: string;
  5. meta: string;
  6. annotationApprover: boolean | null;
  7. commentCount: number;
  8. isApproved: boolean;
  9. constructor(item: DocumentItem) {
  10. this.id = item.id;
  11. this.text = item.text;
  12. this.meta = item.meta;
  13. this.annotationApprover = item.annotationApprover;
  14. this.commentCount = item.commentCount;
  15. this.isApproved = !!item.annotationApprover;
  16. }
  17. }
  18. export class DocumentListDTO {
  19. count: number
  20. next : string | null
  21. prev : string | null
  22. items: DocumentDTO[]
  23. constructor(item: DocumentItemList) {
  24. this.count = item.count
  25. this.next = item.next
  26. this.prev = item.prev
  27. this.items = item.items.map(_ => new DocumentDTO(_))
  28. }
  29. }