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.

56 lines
1.8 KiB

  1. import { ProjectReadItem, CurrentUsersRole, ProjectType } from '~/domain/models/project/project'
  2. import { FormatItem } from '~/domain/models/document/format'
  3. export class FormatDTO {
  4. example: string
  5. type: string
  6. text: string
  7. extension: string
  8. constructor(item: FormatItem) {
  9. this.example = item.example
  10. this.type = item.type
  11. this.text = item.text
  12. this.extension = item.extension
  13. }
  14. }
  15. export class ProjectDTO {
  16. id: number
  17. name: string
  18. description: string
  19. guideline: string
  20. current_users_role: CurrentUsersRole
  21. projectType: ProjectType
  22. updatedAt: string
  23. enableRandomizeDocOrder: boolean
  24. enableShareAnnotation: boolean
  25. singleClassClassification: boolean
  26. pageLink: string
  27. downloadFormats: FormatDTO[]
  28. uploadFormats: FormatDTO[]
  29. permitApprove: Boolean
  30. filterOption: String
  31. constructor(item: ProjectReadItem) {
  32. this.id = item.id
  33. this.name = item.name
  34. this.description = item.description
  35. this.guideline = item.guideline
  36. this.current_users_role = item.current_users_role
  37. this.projectType = item.project_type
  38. this.updatedAt = item.updated_at
  39. this.enableRandomizeDocOrder = item.randomize_document_order
  40. this.enableShareAnnotation = item.collaborative_annotation
  41. this.singleClassClassification = item.single_class_classification
  42. this.pageLink = item.annotationPageLink
  43. this.downloadFormats = item.downloadFormats.map(f => new FormatDTO(f))
  44. this.uploadFormats = item.uploadFormats.map(f => new FormatDTO(f))
  45. this.permitApprove = item.permitApprove
  46. this.filterOption = item.filterOption
  47. }
  48. }
  49. export type ProjectWriteDTO = Pick<ProjectDTO, 'id' | 'name' | 'description' | 'guideline' | 'projectType' | 'enableRandomizeDocOrder' | 'enableShareAnnotation' | 'singleClassClassification'>