eletrotupi / tcc/ api/prisma/schema.prisma81ea07ae23bee8fabf5e0d87cf9cb89507a00384
1.2 KB | 56 lines Raw
1
generator client {
2
  provider = "prisma-client-js"
3
  //output   = "../src/generated/prisma"
4
}
5

6
datasource db {
7
  provider = "postgresql"
8
}
9

10
model User {
11
  id Int @id @default(autoincrement())
12
  firstName String @map("first_name")
13
  lastName String? @map("last_name")
14
  email String @unique
15
  encryptedPassword String @map("encrypted_password")
16
  passwordResetToken String? @map("password_reset_token")
17
  passwordResetExpires DateTime? @map("password_reset_expires")
18
  createdAt DateTime @default(now()) @map("created_at")
19
  updatedAt DateTime @updatedAt @map("updated_at")
20

21
  moods Mood[]
22

23
  @@map("users")
24
}
25

26
model Mood {
27
  id Int @id @default(autoincrement())
28
  description String? @db.Text
29
  moment DateTime @default(now())
30
  anxietyLevel Int @map("anxiety_level")
31
  stressLevel Int @map("stress_level")
32
  energyLevel Int @map("energy_level")
33
  userId Int @map("user_id")
34
  user User @relation(fields: [userId], references: [id])
35

36
  moodComponents MoodComponent[]
37

38
  @@map("moods")
39
}
40

41
model MoodComponent {
42
  id Int @id @default(autoincrement())
43
  comment String?
44
  intensity IntensityLevel @default(LIGHT)
45

46
  moodId Int @map("mood_id")
47
  mood Mood @relation(fields: [moodId], references: [id])
48

49
  @@map("mood_components")
50
}
51

52
enum IntensityLevel {
53
  LIGHT
54
  MODERATE
55
  HIGH
56
}