mirror of
https://github.com/Snouzy/workout-cool.git
synced 2026-05-19 14:40:35 +00:00
266 lines
5.3 KiB
Plaintext
266 lines
5.3 KiB
Plaintext
// This is your Prisma schema file
|
|
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "postgresql"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
enum UserRole {
|
|
admin
|
|
user
|
|
}
|
|
|
|
model User {
|
|
id String @id
|
|
firstName String @default("")
|
|
lastName String @default("")
|
|
name String
|
|
email String @unique
|
|
emailVerified Boolean
|
|
image String?
|
|
locale String? @default("fr")
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
sessions Session[]
|
|
accounts Account[]
|
|
feedbacks Feedbacks[]
|
|
|
|
role UserRole? @default(user)
|
|
banned Boolean? @default(false)
|
|
banReason String?
|
|
banExpires DateTime?
|
|
|
|
@@map("user")
|
|
}
|
|
|
|
model Session {
|
|
id String @id
|
|
expiresAt DateTime
|
|
token String @unique
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
ipAddress String?
|
|
userAgent String?
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
|
|
impersonatedBy String?
|
|
|
|
@@map("session")
|
|
}
|
|
|
|
model Account {
|
|
id String @id
|
|
accountId String
|
|
providerId String
|
|
userId String
|
|
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
|
|
accessToken String?
|
|
refreshToken String?
|
|
idToken String?
|
|
accessTokenExpiresAt DateTime?
|
|
refreshTokenExpiresAt DateTime?
|
|
scope String?
|
|
password String?
|
|
createdAt DateTime
|
|
updatedAt DateTime
|
|
|
|
@@map("account")
|
|
}
|
|
|
|
model Verification {
|
|
id String @id
|
|
identifier String
|
|
value String
|
|
expiresAt DateTime
|
|
createdAt DateTime?
|
|
updatedAt DateTime?
|
|
|
|
@@map("verification")
|
|
}
|
|
|
|
model Feedbacks {
|
|
id String @id @default(cuid())
|
|
review Int
|
|
message String
|
|
email String?
|
|
userId String?
|
|
user User? @relation(fields: [userId], references: [id], onDelete: SetNull)
|
|
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
@@map("feedbacks")
|
|
}
|
|
|
|
model Exercise {
|
|
id String @id @default(cuid())
|
|
name String
|
|
nameEn String?
|
|
description String? @db.Text
|
|
descriptionEn String? @db.Text
|
|
fullVideoUrl String? @db.Text
|
|
fullVideoImageUrl String? @db.Text
|
|
introduction String? @db.Text
|
|
introductionEn String? @db.Text
|
|
slug String? @unique
|
|
slugEn String? @unique
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Relations
|
|
attributes ExerciseAttribute[]
|
|
|
|
@@map("exercises")
|
|
}
|
|
|
|
model ExerciseAttributeName {
|
|
id String @id @default(cuid())
|
|
name ExerciseAttributeNameEnum @unique
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Relations
|
|
values ExerciseAttributeValue[]
|
|
attributes ExerciseAttribute[]
|
|
|
|
@@map("exercise_attribute_names")
|
|
}
|
|
|
|
model ExerciseAttributeValue {
|
|
id String @id @default(cuid())
|
|
attributeNameId String
|
|
value ExerciseAttributeValueEnum
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Relations
|
|
attributeName ExerciseAttributeName @relation(fields: [attributeNameId], references: [id])
|
|
attributes ExerciseAttribute[]
|
|
|
|
@@unique([attributeNameId, value])
|
|
@@map("exercise_attribute_values")
|
|
}
|
|
|
|
model ExerciseAttribute {
|
|
id String @id @default(cuid())
|
|
exerciseId String
|
|
attributeNameId String
|
|
attributeValueId String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Relations
|
|
exercise Exercise @relation(fields: [exerciseId], references: [id], onDelete: Cascade)
|
|
attributeName ExerciseAttributeName @relation(fields: [attributeNameId], references: [id])
|
|
attributeValue ExerciseAttributeValue @relation(fields: [attributeValueId], references: [id])
|
|
|
|
@@unique([exerciseId, attributeNameId, attributeValueId])
|
|
@@map("exercise_attributes")
|
|
}
|
|
|
|
// Enums
|
|
enum ExercisePrivacy {
|
|
PUBLIC
|
|
PRIVATE
|
|
}
|
|
|
|
// Noms d'attributs
|
|
enum ExerciseAttributeNameEnum {
|
|
TYPE
|
|
PRIMARY_MUSCLE
|
|
SECONDARY_MUSCLE
|
|
EQUIPMENT
|
|
MECHANICS_TYPE
|
|
}
|
|
|
|
// Toutes les valeurs possibles
|
|
enum ExerciseAttributeValueEnum {
|
|
// Types d'exercices
|
|
BODYWEIGHT
|
|
STRENGTH
|
|
POWERLIFTING
|
|
CALISTHENIC
|
|
PLYOMETRICS
|
|
STRETCHING
|
|
STRONGMAN
|
|
CARDIO
|
|
STABILIZATION
|
|
POWER
|
|
RESISTANCE
|
|
CROSSFIT
|
|
WEIGHTLIFTING
|
|
|
|
// Groupes musculaires
|
|
BICEPS
|
|
SHOULDERS
|
|
CHEST
|
|
BACK
|
|
GLUTES
|
|
TRICEPS
|
|
HAMSTRINGS
|
|
QUADRICEPS
|
|
FOREARMS
|
|
CALVES
|
|
TRAPS
|
|
ABDOMINALS
|
|
NECK
|
|
LATS
|
|
ADDUCTORS
|
|
ABDUCTORS
|
|
OBLIQUES
|
|
GROIN
|
|
FULL_BODY
|
|
ROTATOR_CUFF
|
|
HIP_FLEXOR
|
|
ACHILLES_TENDON
|
|
FINGERS
|
|
|
|
// Équipements
|
|
DUMBBELL
|
|
KETTLEBELLS
|
|
BARBELL
|
|
SMITH_MACHINE
|
|
BODY_ONLY
|
|
OTHER
|
|
BANDS
|
|
EZ_BAR
|
|
MACHINE
|
|
DESK
|
|
PULLUP_BAR
|
|
NONE
|
|
CABLE
|
|
MEDICINE_BALL
|
|
SWISS_BALL
|
|
FOAM_ROLL
|
|
WEIGHT_PLATE
|
|
TRX
|
|
BOX
|
|
ROPES
|
|
SPIN_BIKE
|
|
STEP
|
|
BOSU
|
|
TYRE
|
|
SANDBAG
|
|
POLE
|
|
BENCH
|
|
WALL
|
|
BAR
|
|
RACK
|
|
CAR
|
|
SLED
|
|
CHAIN
|
|
SKIERG
|
|
ROPE
|
|
NA
|
|
|
|
// Types de mécanique
|
|
ISOLATION
|
|
COMPOUND
|
|
}
|