datamodel.prisma 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. type User {
  2. id: ID! @id
  3. email: String! @unique
  4. name: String!
  5. password: String!
  6. resetToken: String
  7. resetTokenExpiry: Float
  8. createdAt: DateTime! @createdAt
  9. comments: [Comment!]!
  10. ratings: [Rating!]!
  11. permissions: [Permission!]! @scalarList(strategy: RELATION)
  12. interests: [String!]! @scalarList(strategy: RELATION)
  13. }
  14. enum Permission {
  15. ADMIN
  16. INSTRUCTOR
  17. }
  18. type File {
  19. id: ID! @id
  20. createdAt: DateTime! @createdAt
  21. updatedAt: DateTime! @updatedAt
  22. path: String!
  23. mimetype: String!
  24. user: User!
  25. thumbnail: String
  26. filename: String!
  27. encoding: String!
  28. size: Int!
  29. comment: String
  30. }
  31. type Training {
  32. id: ID! @id
  33. title: String!
  34. type: TrainingType!
  35. createdAt: DateTime! @createdAt
  36. trainingDate: DateTime!
  37. location: String!
  38. registrations: [User!]!
  39. attendance: Int
  40. ratings: [Rating!]!
  41. published: Boolean!
  42. blocks: [BlockInstance!]! @relation(onDelete: CASCADE)
  43. }
  44. type TrainingType {
  45. id: ID! @id
  46. name: String! @unique
  47. description: String!
  48. }
  49. type Block {
  50. id: ID! @id
  51. title: String!
  52. description: String
  53. videos: [String!]! @scalarList(strategy: RELATION)
  54. pictures: [String!]! @scalarList(strategy: RELATION)
  55. duration: Int
  56. format: Format!
  57. rest: Int
  58. tracks: [Track!]!
  59. blocks: [BlockInstance!] @relation(name: "Instances", onDelete: CASCADE)
  60. links: [BlockInstance!]! @relation(name: "ParentChild", onDelete: CASCADE)
  61. exercises: [ExerciseInstance!]! @relation(onDelete: CASCADE)
  62. }
  63. type BlockInstance {
  64. id: ID! @id
  65. block: Block! @relation(name: "ParentChild", onDelete: SET_NULL)
  66. parentBlock: Block @relation(name: "Instances")
  67. parentTraining: Training @relation(link: INLINE)
  68. order: Int!
  69. rounds: Int
  70. variation: String
  71. }
  72. type Format {
  73. id: ID! @id
  74. name: String!
  75. description: String!
  76. }
  77. type Track {
  78. id: ID! @id
  79. title: String!
  80. artist: String!
  81. duration: Int!
  82. link: String!
  83. }
  84. type Exercise {
  85. id: ID! @id
  86. name: String!
  87. description: String
  88. videos: [String!]! @scalarList(strategy: RELATION)
  89. pictures: [String!]! @scalarList(strategy: RELATION)
  90. targets: [String!]! @scalarList(strategy: RELATION)
  91. baseExercise: [String!]! @scalarList(strategy: RELATION)
  92. }
  93. type ExerciseInstance {
  94. id: ID! @id
  95. exercise: Exercise! @relation(link: INLINE)
  96. order: Int!
  97. repetitions: Int
  98. variation: String
  99. }
  100. type Rating {
  101. id: ID! @id
  102. user: User!
  103. value: Int!
  104. comment: String!
  105. createdAt: DateTime! @createdAt
  106. }
  107. type Comment {
  108. id: ID! @id
  109. text: String!
  110. author: User!
  111. createdAt: DateTime! @createdAt
  112. }