mirror of
https://github.com/LucasVbr/meeting-app.git
synced 2026-05-13 17:21:53 +00:00
28be7ce223
Took 1 hour 58 minutes
123 lines
3.0 KiB
Plaintext
123 lines
3.0 KiB
Plaintext
// Connexion
|
|
generator client {
|
|
provider = "prisma-client-js"
|
|
}
|
|
|
|
datasource db {
|
|
provider = "mongodb"
|
|
url = env("DATABASE_URL")
|
|
}
|
|
|
|
// Models
|
|
model User {
|
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
email String @unique
|
|
password String
|
|
firstName String?
|
|
lastName String?
|
|
bio String?
|
|
location String?
|
|
images String[]
|
|
birthdate DateTime?
|
|
gender Gender @default(UNKNOWN)
|
|
role Role @default(USER)
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Liste des chats de l'utilisateur
|
|
ChatID String[] @db.ObjectId
|
|
Chat Chat[] @relation(fields: [ChatID], references: [id])
|
|
|
|
// Liste des passions de l'utilisateur
|
|
PassionID String[] @db.ObjectId
|
|
Passion Passion[] @relation(fields: [PassionID], references: [id])
|
|
|
|
// Les messages envoyés
|
|
Message Message[]
|
|
|
|
// Les personnes que l'utilisateur aime
|
|
UserLikesID String[] @db.ObjectId
|
|
UserLikes User[] @relation("Likes", fields: [UserLikesID], references: [id])
|
|
|
|
// Les personnes qui aiment l'utilisateur
|
|
OtherUserLikesID String[] @db.ObjectId
|
|
OtherUserLikes User[] @relation("Likes", fields: [OtherUserLikesID], references: [id])
|
|
|
|
MatchID String[] @db.ObjectId
|
|
Match Match[] @relation(fields: [MatchID], references: [id])
|
|
|
|
Notification Notification[]
|
|
}
|
|
|
|
model Notification {
|
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
type NotificationType
|
|
createdAt DateTime @default(now())
|
|
hasBeenConsulted Boolean @default(false)
|
|
|
|
UserID String @db.ObjectId
|
|
User User @relation(fields: [UserID], references: [id])
|
|
}
|
|
|
|
model Match {
|
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
createdAt DateTime @default(now())
|
|
|
|
UserID String[] @db.ObjectId
|
|
User User[] @relation(fields: [UserID], references: [id])
|
|
}
|
|
|
|
model Passion {
|
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
name String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// Les utilisateurs qui on en commun cette passion
|
|
UserID String[] @db.ObjectId
|
|
User User[] @relation(fields: [UserID], references: [id])
|
|
}
|
|
|
|
model Chat {
|
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
messages Message[]
|
|
createdAt DateTime @default(now())
|
|
|
|
// Les utilisateurs qui ont un chat en commun
|
|
User User[] @relation(fields: [UserID], references: [id])
|
|
UserID String[] @db.ObjectId
|
|
}
|
|
|
|
model Message {
|
|
id String @id @default(auto()) @map("_id") @db.ObjectId
|
|
message String
|
|
createdAt DateTime @default(now())
|
|
updatedAt DateTime @updatedAt
|
|
|
|
// L'utilisateur qui a envoyé le message
|
|
UserID String @db.ObjectId
|
|
User User @relation(fields: [UserID], references: [id])
|
|
|
|
// Le chat où ce trouve le message
|
|
ChatID String? @db.ObjectId
|
|
Chat Chat? @relation(fields: [ChatID], references: [id])
|
|
}
|
|
|
|
enum Gender {
|
|
MALE
|
|
FEMALE
|
|
OTHER
|
|
UNKNOWN
|
|
}
|
|
|
|
enum NotificationType {
|
|
NEW_MATCH
|
|
NEW_LIKE
|
|
NEW_MESSAGE
|
|
}
|
|
|
|
enum Role {
|
|
USER
|
|
ADMIN
|
|
}
|