forked from solfate/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
schema.prisma
182 lines (154 loc) · 5.12 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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
relationMode = "prisma"
}
generator client {
provider = "prisma-client-js"
}
// next-auth and custom
model User {
username String @unique @default(uuid()) @db.VarChar(255)
// start next-auth required
uid Int @unique @default(autoincrement()) @db.UnsignedInt
id String @id @default(cuid())
name String?
email String? @unique
emailVerified DateTime?
image String?
accounts Account[]
sessions Session[]
// end next-auth required
// basic user status info
type UserType? @default(USER)
status Status? @default(ACTIVE)
flags String? @db.VarChar(500)
createdAt DateTime? @default(now()) @db.DateTime(0)
updatedAt DateTime? @updatedAt
// billing information and settings
// customerId String? @unique @db.VarChar(128)
// billingPlan String? @db.VarChar(128)
// billingStatus String? @db.VarChar(128)
// customerType CustomerType? @default(NONE)
// connections to other model structures
profile Profile? @relation("username")
walletList WalletList[] @relation("userId")
@@index([id], name: "user_id_idx")
@@index([email], name: "user_email_idx")
@@index([username], name: "user_username_idx")
@@index([uid], name: "user_uid_idx")
}
// User Profile information
model Profile {
// id Int @unique @default(autoincrement()) @db.UnsignedInt
username String @unique @db.VarChar(255)
user User @relation("username", fields: [username], references: [username])
//
title String?
name String?
image String?
oneLiner String? @default("") @db.VarChar(255)
bio String? @default("") @db.VarChar(255)
verified Boolean @default(false)
// json array of the block elements to be rendered on the page
elements Json? @default("[]")
// json array of the featured links
featuredLinks Json? @default("[]")
//
flags String? @db.VarChar(500)
status Status? @default(ACTIVE)
@@index([username], name: "user_username_idx")
}
// Listing of people and their wallets that have particiapted in our special lists
model WalletList {
id Int @unique @default(autoincrement()) @db.UnsignedInt
userId String
user User @relation("userId", fields: [userId], references: [id])
type ListPersonType
cohort Int? @default(0)
wallet String
twitter String?
questions Json? @default("{}")
data Json? @default("{}")
flags String? @db.VarChar(500)
status Status? @default(PENDING)
lastCheck DateTime? @db.DateTime(0)
// track a single unique asset per record
assetId String?
@@unique([type, wallet])
@@index([userId], name: "user_id_idx")
@@index([wallet], name: "wallet_id_idx")
@@index([twitter], name: "twitter_id_idx")
}
// User types to be used for access controls
enum UserType {
USER
MANAGER
ADMIN
SUPER
OWNER
UNKNOWN
}
// Common statuses to be used throughout the app
enum Status {
INACTIVE
ACTIVE
CLOSED
CANCELED
DISABLED
LOCKED
DELETED
PAID
PENDING
FAILED
UNCLAIMED
}
// Broad category of people
enum ListPersonType {
DEVELOPER
ARTIST
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////
// next-auth specific models
// note: these normally do not change
// Required for next-auth
model Account {
id String @id @default(cuid())
userId String
type String
provider String
providerAccountId String
refresh_token String? @db.Text
// this is required by GitHub
refresh_token_expires_in Int?
access_token String? @db.Text
expires_at Int?
token_type String?
scope String?
id_token String? @db.Text
session_state String?
provider_profile Json? @default("{}")
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@unique([provider, providerAccountId])
@@index([providerAccountId], name: "provider_account_id_idx")
@@index(userId)
}
// required for next-auth
model VerificationToken {
identifier String
token String @unique
expires DateTime
@@unique([identifier, token])
}
// required for next-auth
model Session {
id String @id @default(cuid())
sessionToken String @unique
userId String
expires DateTime
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
@@index(userId)
}
///////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////