File size: 1,430 Bytes
159e7fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
generator client {
  provider = "prisma-client-js"
}

generator json {
  provider = "prisma-json-types-generator"
}

datasource db {
  provider  = "postgresql"
  url       = env("POSTGRES_PRISMA_URL")
  directUrl = env("POSTGRES_URL_NON_POOLING")
}

model User {
  id        String    @id @default(cuid())
  name      String
  email     String    @unique
  createdAt DateTime  @default(now()) @map("created_at")
  updatedAt DateTime  @updatedAt @map("updated_at")
  avatar    String?
  chats     Chat[]
  message   Message[]

  @@map("user")
}

model Chat {
  id        String    @id @default(cuid())
  createdAt DateTime  @default(now()) @map("created_at")
  updatedAt DateTime  @updatedAt @map("updated_at")
  title     String    @default("(no title)")
  mediaUrl  String
  userId    String?
  user      User?     @relation(fields: [userId], references: [id])
  messages  Message[]

  @@map("chat")
}

model Message {
  id        String   @id @default(cuid())
  createdAt DateTime @default(now()) @map("created_at")
  updatedAt DateTime @updatedAt @map("updated_at")
  userId    String?
  chatId    String
  mediaUrl  String
  prompt    String
  response  String?
  /// [FinalCodeBody]
  result    Json?
  /// [AgentResponseBodies]
  responseBody Json?
  chat      Chat     @relation(fields: [chatId], references: [id], onDelete: Cascade)
  user      User?    @relation(fields: [userId], references: [id])

  @@map("message")
}