From 4eacbd913d1312cf2a0fb84a244901fcaba16a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=A0s?= Date: Mon, 27 Mar 2023 11:46:42 +0200 Subject: [PATCH] Update schema.prisma Took 24 minutes --- prisma/schema.prisma | 54 +++++++++++++++++++++++++------------------- 1 file changed, 31 insertions(+), 23 deletions(-) diff --git a/prisma/schema.prisma b/prisma/schema.prisma index d8b2033..c98e612 100644 --- a/prisma/schema.prisma +++ b/prisma/schema.prisma @@ -10,20 +10,19 @@ datasource db { // 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 @default(now()) - lastConnexion DateTime @default(now()) + 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 @@ -51,21 +50,28 @@ model User { } model Notification { - id String @id @default(auto()) @map("_id") @db.ObjectId - type NotificationType - UserId String @db.ObjectId - User User @relation(fields: [UserId], references: [id]) + 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 + 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 + 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 @@ -73,8 +79,9 @@ model Passion { } model Chat { - id String @id @default(auto()) @map("_id") @db.ObjectId - messages Message[] + 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]) @@ -85,6 +92,7 @@ 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