datamodel.prisma 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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 Training {
  19. id: ID! @id
  20. title: String!
  21. type: TrainingType!
  22. createdAt: DateTime! @createdAt
  23. trainingDate: DateTime!
  24. location: String!
  25. registrations: [User!]!
  26. attendance: Int
  27. ratings: [Rating!]!
  28. published: Boolean!
  29. blocks: [BlockInstance!]! @relation(onDelete: CASCADE)
  30. }
  31. type TrainingType {
  32. id: ID! @id
  33. name: String! @unique
  34. description: String!
  35. }
  36. type Block {
  37. id: ID! @id
  38. title: String!
  39. description: String
  40. videos: [String!]! @scalarList(strategy: RELATION)
  41. pictures: [String!]! @scalarList(strategy: RELATION)
  42. duration: Int
  43. format: Format!
  44. rest: Int
  45. tracks: [Track!]!
  46. blocks: [BlockInstance!] @relation(name: "Instances", onDelete: CASCADE)
  47. links: [BlockInstance!]! @relation(name: "ParentChild", onDelete: CASCADE)
  48. exercises: [ExerciseInstance!]! @relation(onDelete: CASCADE)
  49. }
  50. type BlockInstance {
  51. id: ID! @id
  52. block: Block! @relation(name: "ParentChild", onDelete: SET_NULL)
  53. parentBlock: Block @relation(name: "Instances")
  54. parentTraining: Training @relation(link: INLINE)
  55. order: Int!
  56. rounds: Int
  57. variation: String
  58. }
  59. type Format {
  60. id: ID! @id
  61. name: String!
  62. description: String!
  63. }
  64. type Track {
  65. id: ID! @id
  66. title: String!
  67. artist: String!
  68. duration: Int!
  69. link: String!
  70. }
  71. type Exercise {
  72. id: ID! @id
  73. name: String!
  74. description: String
  75. videos: [String!]! @scalarList(strategy: RELATION)
  76. pictures: [String!]! @scalarList(strategy: RELATION)
  77. targets: [String!]! @scalarList(strategy: RELATION)
  78. baseExercise: [String!]! @scalarList(strategy: RELATION)
  79. }
  80. type ExerciseInstance {
  81. id: ID! @id
  82. exercise: Exercise! @relation(link: INLINE)
  83. order: Int!
  84. repetitions: Int
  85. variation: String
  86. }
  87. type Rating {
  88. id: ID! @id
  89. user: User!
  90. value: Int!
  91. comment: String!
  92. createdAt: DateTime! @createdAt
  93. }
  94. type Comment {
  95. id: ID! @id
  96. text: String!
  97. author: User!
  98. createdAt: DateTime! @createdAt
  99. }