forked from Lordesdevelopers/lordesapiv2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
114 lines (102 loc) · 3.09 KB
/
schema.prisma
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// 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 = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
username String @unique @db.VarChar(255)
email String @unique @db.VarChar(255)
password String @unique @db.VarChar(255)
profileImage ProfileImage?
bio String?
location String?
catalogue Service[]
catalogueCount Int @default(0)
productCatalogue Product[]
sentNotifications ServiceNotification[] @relation("Sender")
receivedNotifications ServiceNotification[] @relation("Receiver")
chats Chat[]
role UserRole
createdAt DateTime @default(now())
Messages Message[]
}
model Service {
id Int @id @default(autoincrement())
photos ServiceImage[]
name String
price Float
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
createdAt DateTime @default(now())
}
model ServiceImage {
id Int @id @default(autoincrement())
filename String
mimetype String
encoding String
url String
service Service @relation(fields: [serviceId], references: [id])
serviceId Int
}
model ProductImage {
id Int @id @default(autoincrement())
filename String
mimetype String
encoding String
url String
product Product @relation(fields: [productId], references: [id])
productId Int
}
model ProfileImage {
id Int @id @default(autoincrement())
filename String
mimetype String
encoding String
url String
owner User @relation(fields: [ownerId], references: [id])
ownerId Int @unique
}
model Product {
id Int @id @default(autoincrement())
photos ProductImage[]
name String
price Float
quantity Int
owner User @relation(fields: [ownerId], references: [id])
ownerId Int
createdAt DateTime @default(now())
}
model Chat {
id Int @id @default(autoincrement())
participants User[]
messages Message[]
createdAt DateTime @default(now())
}
model Message {
id Int @id @default(autoincrement())
content String
sender User @relation(fields: [senderId], references: [id])
senderId Int
chat Chat @relation(fields: [chatId], references: [id])
chatId Int
sentAt DateTime @default(now())
}
model ServiceNotification {
id Int @id @default(autoincrement())
message String
sender User @relation("Sender", fields: [senderId], references: [id])
senderId Int
receiver User @relation("Receiver", fields: [receiverId], references: [id])
receiverId Int
createdAt DateTime @default(now())
}
enum UserRole {
USER
STYLIST
MERCHANT
}