schema.prisma 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. // This is your Prisma schema file
  2. // learn more about it in the docs: https://pris.ly/d/prisma-schema
  3. generator client {
  4. provider = "prisma-client-js"
  5. }
  6. datasource db {
  7. provider = "postgresql"
  8. url = env("DATABASE_URL")
  9. }
  10. enum UserRole {
  11. admin
  12. user
  13. }
  14. model User {
  15. id String @id
  16. firstName String @default("")
  17. lastName String @default("")
  18. name String
  19. email String @unique
  20. emailVerified Boolean
  21. image String?
  22. locale String? @default("fr")
  23. createdAt DateTime
  24. updatedAt DateTime
  25. sessions Session[]
  26. accounts Account[]
  27. feedbacks Feedbacks[]
  28. role UserRole? @default(user)
  29. banned Boolean? @default(false)
  30. banReason String?
  31. banExpires DateTime?
  32. @@map("user")
  33. }
  34. model Session {
  35. id String @id
  36. expiresAt DateTime
  37. token String @unique
  38. createdAt DateTime
  39. updatedAt DateTime
  40. ipAddress String?
  41. userAgent String?
  42. userId String
  43. user User @relation(fields: [userId], references: [id], onDelete: Cascade)
  44. impersonatedBy String?
  45. @@map("session")
  46. }
  47. model Account {
  48. id String @id
  49. accountId String
  50. providerId String
  51. userId String
  52. user User @relation(fields: [userId], references: [id], onDelete: Cascade)
  53. accessToken String?
  54. refreshToken String?
  55. idToken String?
  56. accessTokenExpiresAt DateTime?
  57. refreshTokenExpiresAt DateTime?
  58. scope String?
  59. password String?
  60. createdAt DateTime
  61. updatedAt DateTime
  62. @@map("account")
  63. }
  64. model Verification {
  65. id String @id
  66. identifier String
  67. value String
  68. expiresAt DateTime
  69. createdAt DateTime?
  70. updatedAt DateTime?
  71. @@map("verification")
  72. }
  73. model Feedbacks {
  74. id String @id @default(cuid())
  75. review Int
  76. message String
  77. email String?
  78. userId String?
  79. user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
  80. createdAt DateTime @default(now())
  81. updatedAt DateTime @updatedAt
  82. @@map("feedbacks")
  83. }
  84. model Exercise {
  85. id String @id @default(cuid())
  86. name String
  87. nameEn String?
  88. description String? @db.Text
  89. descriptionEn String? @db.Text
  90. fullVideoUrl String? @db.Text
  91. fullVideoImageUrl String? @db.Text
  92. introduction String? @db.Text
  93. introductionEn String? @db.Text
  94. slug String? @unique
  95. slugEn String? @unique
  96. createdAt DateTime @default(now())
  97. updatedAt DateTime @updatedAt
  98. // Relations
  99. attributes ExerciseAttribute[]
  100. @@map("exercises")
  101. }
  102. model ExerciseAttributeName {
  103. id String @id @default(cuid())
  104. name ExerciseAttributeNameEnum @unique
  105. createdAt DateTime @default(now())
  106. updatedAt DateTime @updatedAt
  107. // Relations
  108. values ExerciseAttributeValue[]
  109. attributes ExerciseAttribute[]
  110. @@map("exercise_attribute_names")
  111. }
  112. model ExerciseAttributeValue {
  113. id String @id @default(cuid())
  114. attributeNameId String
  115. value ExerciseAttributeValueEnum
  116. createdAt DateTime @default(now())
  117. updatedAt DateTime @updatedAt
  118. // Relations
  119. attributeName ExerciseAttributeName @relation(fields: [attributeNameId], references: [id])
  120. attributes ExerciseAttribute[]
  121. @@unique([attributeNameId, value])
  122. @@map("exercise_attribute_values")
  123. }
  124. model ExerciseAttribute {
  125. id String @id @default(cuid())
  126. exerciseId String
  127. attributeNameId String
  128. attributeValueId String
  129. createdAt DateTime @default(now())
  130. updatedAt DateTime @updatedAt
  131. // Relations
  132. exercise Exercise @relation(fields: [exerciseId], references: [id], onDelete: Cascade)
  133. attributeName ExerciseAttributeName @relation(fields: [attributeNameId], references: [id])
  134. attributeValue ExerciseAttributeValue @relation(fields: [attributeValueId], references: [id])
  135. @@unique([exerciseId, attributeNameId, attributeValueId])
  136. @@map("exercise_attributes")
  137. }
  138. // Enums
  139. enum ExercisePrivacy {
  140. PUBLIC
  141. PRIVATE
  142. }
  143. // Noms d'attributs
  144. enum ExerciseAttributeNameEnum {
  145. TYPE
  146. PRIMARY_MUSCLE
  147. SECONDARY_MUSCLE
  148. EQUIPMENT
  149. MECHANICS_TYPE
  150. }
  151. // Toutes les valeurs possibles
  152. enum ExerciseAttributeValueEnum {
  153. // Types d'exercices
  154. BODYWEIGHT
  155. STRENGTH
  156. POWERLIFTING
  157. CALISTHENIC
  158. PLYOMETRICS
  159. STRETCHING
  160. STRONGMAN
  161. CARDIO
  162. STABILIZATION
  163. POWER
  164. RESISTANCE
  165. CROSSFIT
  166. WEIGHTLIFTING
  167. // Groupes musculaires
  168. BICEPS
  169. SHOULDERS
  170. CHEST
  171. BACK
  172. GLUTES
  173. TRICEPS
  174. HAMSTRINGS
  175. QUADRICEPS
  176. FOREARMS
  177. CALVES
  178. TRAPS
  179. ABDOMINALS
  180. NECK
  181. LATS
  182. ADDUCTORS
  183. ABDUCTORS
  184. OBLIQUES
  185. GROIN
  186. FULL_BODY
  187. ROTATOR_CUFF
  188. HIP_FLEXOR
  189. ACHILLES_TENDON
  190. FINGERS
  191. // Équipements
  192. DUMBBELL
  193. KETTLEBELLS
  194. BARBELL
  195. SMITH_MACHINE
  196. BODY_ONLY
  197. OTHER
  198. BANDS
  199. EZ_BAR
  200. MACHINE
  201. DESK
  202. PULLUP_BAR
  203. NONE
  204. CABLE
  205. MEDICINE_BALL
  206. SWISS_BALL
  207. FOAM_ROLL
  208. WEIGHT_PLATE
  209. TRX
  210. BOX
  211. ROPES
  212. SPIN_BIKE
  213. STEP
  214. BOSU
  215. TYRE
  216. SANDBAG
  217. POLE
  218. BENCH
  219. WALL
  220. BAR
  221. RACK
  222. CAR
  223. SLED
  224. CHAIN
  225. SKIERG
  226. ROPE
  227. NA
  228. // Types de mécanique
  229. ISOLATION
  230. COMPOUND
  231. }