eletrotupi / tcc/ api/prisma/schema.prisma95520d874f28f49a762a222a2ab593de585a0436
1.7 KB | 79 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
  interventions Intervention[]
23

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

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

37
  moodComponents MoodComponent[]
38

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

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

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

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

53
model Intervention {
54
  id Int @id @default(autoincrement())
55
	comment String?
56
	interventionType InterventionType @map("intervention_type")
57
	eficacy Int
58
  startAt DateTime @map("start_at")
59
  endAt DateTime @map("end_at")
60

61
  userId Int @map("user_id")
62
  user User @relation(fields: [userId], references: [id])
63

64
  @@map("interventions")
65
}
66

67
enum IntensityLevel {
68
  LIGHT
69
  MODERATE
70
  HIGH
71
}
72

73
enum InterventionType {
74
  MEDICATION
75
  THERAPY
76
  MEDITATION
77
  EXERCISE
78
  CONVERSATION
79
}