-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
120 lines (107 loc) · 3.18 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
115
116
117
118
119
120
generator client {
provider = "prisma-client-js"
}
generator typegraphql {
provider = "typegraphql-prisma"
formatGeneratedCode = "prettier"
omitInputFieldsByDefault = ["createdAt", "updatedAt"]
omitOutputFieldsByDefault = ["password"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model Role {
/// @TypeGraphQL.omit(input: ["create", "update"])
id String @id @default(uuid())
name String @unique
scopes String[] @default([])
User User[]
/// @TypeGraphQL.omit(input: true)
persistent Boolean @default(false)
}
model User {
/// @TypeGraphQL.omit(input: ["create", "update"])
id String @id @default(uuid())
email String @unique
/// @TypeGraphQL.omit(output: true, input: ["where", "orderBy"])
password String
role Role @relation(fields: [roleId], references: [id])
/// @TypeGraphQL.omit(output: true)
roleId String
/// @TypeGraphQL.omit(output: true, input: true)
sessionId String @unique @default(uuid())
/// @TypeGraphQL.omit(input: ["create", "update"])
persistent Boolean @default(false)
}
enum CurrencyCode {
EUR
}
model Store {
/// @TypeGraphQL.omit(input: ["create", "update"])
id String @id @default(uuid())
name String
description String?
currencyCode CurrencyCode
collections Collection[]
products Product[]
}
model Collection {
/// @TypeGraphQL.omit(input: ["create", "update"])
id String @id @default(uuid())
name String
description String?
/// @TypeGraphQL.omit(output: true)
storeId String?
store Store? @relation(fields: [storeId], references: [id])
products Product[] @relation("CollectionToProduct")
}
enum ProductStatus {
Published
Draft
}
model Product {
/// @TypeGraphQL.omit(input: ["create", "update"])
id String @id @default(uuid())
name String
description String?
price Decimal @db.Money
stock Int
status ProductStatus
/// @TypeGraphQL.omit(output: true)
storeId String
store Store @relation(fields: [storeId], references: [id])
images ProductImage[]
variants ProductVariant[]
collections Collection[] @relation("CollectionToProduct")
}
model ProductImage {
/// @TypeGraphQL.omit(input: ["create", "update"])
id String @id @default(uuid())
fileId String
file File @relation(fields: [fileId], references: [id])
alt String?
orderIndex Int
/// @TypeGraphQL.omit(output: true)
productId String
product Product @relation(fields: [productId], references: [id])
}
model ProductVariant {
/// @TypeGraphQL.omit(input: ["create", "update"])
id String @id @default(uuid())
name String
description String?
price Decimal @db.Money
stock Int
/// @TypeGraphQL.omit(output: true)
productId String
product Product @relation(fields: [productId], references: [id])
}
model File {
id String @id @default(uuid())
bucket String
key String
contentType String
images ProductImage[]
@@unique(name: "src", [bucket, key])
}