forked from Missile-Wars-Revival/backend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathschema.prisma
237 lines (216 loc) · 7.32 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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model FriendRequests {
id Int @id @default(autoincrement())
username String @default("")
friend String @default("")
gameplayUserId Int?
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
deletedAt DateTime @default(now())
GameplayUser GameplayUser? @relation(fields: [gameplayUserId], references: [id])
}
model GameplayUser {
id Int @id @default(autoincrement())
username String @unique @default("")
level Int @default(1)
exp Int @default(0)
money Int @default(2000)
health Int @default(100)
friendsOnly Boolean @default(false)
rank String @default("Private")
rankPoints Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
deletedAt DateTime @default(now())
isAlive Boolean @default(true)
leagueId String?
locActive Boolean @default(true)
randomLocation Boolean @default(false)
FriendRequests FriendRequests[]
league League? @relation(fields: [leagueId], references: [id])
Users Users @relation(fields: [username], references: [username])
InventoryItem InventoryItem[]
Locations Locations?
Statistics Statistics[]
}
model PasswordResetCodes {
id Int @id @default(autoincrement())
userId Int
code String
expiry DateTime
createdAt DateTime @default(now())
user Users @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model InventoryItem {
id BigInt @id @default(autoincrement())
name String
quantity Int
userId Int
category String
GameplayUser GameplayUser @relation(fields: [userId], references: [id])
}
model Statistics {
id BigInt @id @default(autoincrement())
userId Int
badges String[] @default([])
numDeaths Int @default(0)
numLootPlaced Int @default(0)
numLandminesPlaced Int @default(0)
numMissilesPlaced Int @default(0)
numLootPickups Int @default(0)
numKills Int @default(0)
GameplayUser GameplayUser @relation(fields: [userId], references: [id])
}
model Landmine {
id Int @id @default(autoincrement())
placedBy String
locLat String @default("")
locLong String @default("")
type String
Expires DateTime
damage Int @default(1)
placedTime DateTime @default(now())
}
model LandmineType {
name String @id @unique
description String
price Int
damage Int
duration Int
}
model Locations {
username String @id @unique @default("")
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
deletedAt DateTime @default(now())
latitude String @default("")
longitude String @default("")
lastUpdated DateTime @default(now())
previousLat String @default("")
previousLong String @default("")
transportStatus String @default("walking")
GameplayUser GameplayUser @relation(fields: [username], references: [username])
}
model Loot {
id Int @id @default(autoincrement())
rarity String
Expires DateTime
locLat String @default("")
locLong String @default("")
}
model Other {
id Int @id @default(autoincrement())
type String
radius Int
Expires DateTime
locLat String @default("")
locLong String @default("")
placedBy String @default("")
placedTime DateTime @default(now())
}
model OtherType {
name String @id @unique
description String
price Int
radius Int
duration Int
}
model Messages {
id Int @id @default(autoincrement())
sender String @default("")
receiver String @default("")
content String @default("")
createdAt String @default("")
updatedAt String @default("")
deletedAt String @default("")
}
model Missile {
id Int @id @default(autoincrement())
destLat String @default("")
destLong String @default("")
damage Int @default(1)
radius Int
type String
sentBy String
sentAt DateTime
status String
currentLat String @default("")
currentLong String @default("")
timeToImpact DateTime
}
model MissileType {
name String @id @unique
description String
price Int
speed Int
radius Int
damage Int
fallout Int
}
model RefreshTokens {
id Int @id @default(autoincrement())
refreshToken String @default("")
}
model Sessions {
lastIp String @default("")
id Int @id @default(autoincrement())
userId Int
lastLoginTime DateTime @default(now())
user Users @relation(fields: [userId], references: [id], onDelete: Cascade)
}
model Users {
id Int @id @default(autoincrement())
email String @default("")
password String @default("")
username String @unique @default("")
role String @default("user")
avatar String @default("")
friends String[] @default([])
notificationToken String @default("")
createdAt DateTime @default(now())
deletedAt DateTime @default(now())
updatedAt DateTime @default(now())
stripeCustomerId String? @unique
GameplayUser GameplayUser?
notificationPreferences NotificationPreferences?
Notifications Notifications[]
passwordResetCodes PasswordResetCodes[]
Sessions Sessions[]
}
model Notifications {
id String @id @default(uuid())
userId String
title String
body String
timestamp DateTime @default(now())
isRead Boolean @default(false)
sentby String @default("")
user Users @relation(fields: [userId], references: [username])
}
model NotificationPreferences {
id Int @id @default(autoincrement())
userId Int @unique
incomingEntities Boolean @default(true)
entityDamage Boolean @default(true)
entitiesInAirspace Boolean @default(true)
eliminationReward Boolean @default(true)
lootDrops Boolean @default(true)
friendRequests Boolean @default(true)
leagues Boolean @default(true)
user Users @relation(fields: [userId], references: [id])
}
model League {
id String @id @default(uuid())
tier String
division String
number Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
players GameplayUser[]
}