File size: 1,901 Bytes
17aecfb
 
 
 
 
 
 
 
 
 
 
 
 
d6da254
 
 
 
 
 
 
 
 
 
 
eb29a95
 
 
d6da254
 
 
 
404baa5
d6da254
 
 
 
 
eb29a95
 
 
d6da254
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17aecfb
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
60
61
62
63
64
65
66
67
68
69
70
71
72
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

generator client {
  provider = "prisma-client-js"
}

datasource db {
  provider = "sqlite"
  url      = env("DATABASE_URL")
}

model Model {
  id        String    @id
  createdAt DateTime  @default(now())
  title     String
  image     String
  likes     Int?
  downloads Int?
  isPublic  Boolean   @default(false)
  user      User?     @relation(fields: [userId], references: [sub])
  userId    String?
  gallery   Gallery[]
  comments  Comment[]
}

model Gallery {
  id        String     @id @default(uuid())
  createdAt DateTime   @default(now())
  prompt    String
  image     String
  isPublic  Boolean    @default(false)
  reactions Reaction[]
  model     Model      @relation(fields: [modelId], references: [id])
  modelId   String
  user      User?      @relation(fields: [userId], references: [sub])
  userId    String?
}

model Reaction {
  id        String   @id @default(uuid())
  createdAt DateTime @default(now())
  emoji     String
  user      User     @relation(fields: [userId], references: [sub])
  gallery   Gallery? @relation(fields: [galleryId], references: [id])
  userId    String
  galleryId String?
}

model Comment {
  id        String   @id @default(uuid())
  createdAt DateTime @default(now())
  text      String
  user      User     @relation(fields: [userId], references: [sub])
  userId    String
  model     Model?   @relation(fields: [modelId], references: [id])
  modelId   String?
}

model User {
  id                 String     @id @default(uuid())
  createdAt          DateTime   @default(now())
  sub                String     @unique
  name               String
  preferred_username String     @unique
  picture            String?
  comments           Comment[]
  reactions          Reaction[]
  gallery            Gallery[]
  models             Model[]
}