-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.dbml
More file actions
282 lines (243 loc) · 6.91 KB
/
Copy pathschema.dbml
File metadata and controls
282 lines (243 loc) · 6.91 KB
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
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
//// ------------------------------------------------------
//// THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
//// ------------------------------------------------------
Table jobs {
id Int [pk, increment]
title String [not null]
companyId Int
company companies
author String
location String
url String [unique, not null]
postedAt DateTime
description String
isRemote Boolean
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
source String
externalId String
data Json
tags job_tags [not null]
metadata job_metadata [not null]
Note: 'Stores job listings from all sources (Reddit, Web3Career, etc).
Contains only the main, normalized/shared job fields.'
}
Table companies {
id Int [pk, increment]
name String [unique, not null]
jobs jobs [not null]
createdAt DateTime [default: `now()`, not null]
Note: 'Stores company information, normalized so jobs with the same company point here.'
}
Table tags {
id Int [pk, increment]
name String [unique, not null]
jobTags job_tags [not null]
taggables taggables [not null]
Note: 'Stores unique tags (skills, role types, etc).
Used for jobs and supports future polymorphic tagging.'
}
Table job_tags {
id Int [pk, increment]
jobId Int [not null]
tagId Int [not null]
job jobs [not null]
tag tags [not null]
indexes {
(jobId, tagId) [unique]
}
Note: 'Join table for many-to-many Job <-> Tag relationships.
Each row links a job to a tag.'
}
Table job_metadata {
id Int [pk, increment]
jobId Int [not null]
name String [not null]
value String [not null]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
job jobs [not null]
indexes {
(jobId, name) [unique]
}
Note: 'Stores arbitrary name/value metadata for jobs.
Allows storage of extra source-specific or custom fields.'
}
Table taggables {
id Int [pk, increment]
tagId Int [not null]
tagType String [not null]
taggableId Int [not null]
tag tags [not null]
createdAt DateTime [default: `now()`, not null]
Note: 'Enables polymorphic tagging (linking tags to any model, not just jobs).
For future extensibility; currently jobs use JobTag directly.'
}
Table reddit_posts {
id Int [pk, increment]
title String [not null]
author String [not null]
subreddit String [not null]
url String [unique, not null]
type String [not null, default: 'reddit']
body String
bodyHtml String
upvotes Int [not null, default: 0]
downvotes Int [not null, default: 0]
createdAt DateTime [default: `now()`, not null]
postedAt DateTime [not null, note: 'The original creation time on Reddit.']
Note: 'Stores posts scraped from Reddit.'
}
Table payment_attempts {
id String [pk]
invoiceIdentifier String [not null]
provider PaymentProvider [not null]
method PaymentMethod [not null]
selection PaymentSelection [not null]
status PaymentStatus [not null, default: 'INITIATED']
currency String [not null, default: 'USD']
amountCents Int [not null]
invoiceTotalCents Int [not null]
invoiceBalanceCents Int [not null]
clientName String
clientFirm String
clientAddress String
stripePaymentIntentId String [unique]
stripePaymentMethodId String
stripeChargeId String
receiptUrl String
cardBrand String
cardLast4 String
billingPostalCode String
failureCode String
failureMessage String
requestPayload Json
invoiceSnapshot Json
providerResponse Json
finalizedAt DateTime
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
}
Table subscriptions {
id Int [pk, increment]
ipAddress String [not null]
type SubscriptionType [not null, default: 'web']
endpoint String [unique, not null]
keys Json [note: 'Auth keys required for sending push notifications.']
createdAt DateTime [default: `now()`, not null]
locations locations [not null]
indexes {
(endpoint, type, keys) [unique]
}
Note: 'Stores user subscriptions for push notifications.'
}
Table users {
id Int [pk, increment]
createdAt DateTime [default: `now()`, not null]
updatedAt DateTime [not null]
email String [unique, not null]
password String [not null]
firstname String
lastname String
username String
profilePicture String
googleId String [unique]
role Role [not null, default: 'USER']
wallet String [unique]
is_active Boolean [default: true]
}
Table locations {
id Int [pk, increment]
ipAddress String [not null]
accuracy Float
altitude Float
altitudeAccuracy Float
heading Float
latitude Float
longitude Float
speed Float
mocked Boolean [not null, note: 'True if location was from a mock provider.']
timestamp BigInt [note: 'Original Unix timestamp from the client.']
city String
country String
district String
formattedAddress String
isoCountryCode String
name String
postalCode String
region String
street String
streetNumber String
subregion String
timezone String
createdAt DateTime [default: `now()`, not null]
subscriptionId Int [not null]
subscription subscriptions [not null]
Note: 'Stores location data points for subscriptions.'
}
Table reddit_messages {
id Int [pk, increment]
redditId String [unique, not null, note: 'The unique ID from the Reddit API.']
type String [not null, note: 'e.g., "comment", "post", "dm".']
author String [not null]
content String [not null]
bodyHtml String
subreddit String
contextUrl String
parentId String [note: 'For message threading.']
messageType String [note: 'e.g., "inbox", "sent", "modmail".']
isRead Boolean [not null, default: false]
isSubredditModMail Boolean [not null, default: false]
isInternal Boolean [not null, default: false, note: 'For mod-to-mod discussions.']
rawData Json [note: 'Stores the original API response.']
createdAt DateTime [not null, note: 'The original creation time on Reddit.']
receivedAt DateTime [default: `now()`, not null]
Note: 'Stores messages received from Reddit (comments, DMs, etc.).'
}
Table error_reports {
id String [pk]
message String [not null]
stack String
platform String [note: '\'android\', \'ios\', \'web\', etc.']
isFatal Boolean [note: 'True if the error crashed the client app.']
errorInfo Json [note: 'React Error Boundary info, like componentStack.']
payload Json [not null, note: 'The complete, raw JSON payload from the client.']
createdAt DateTime [default: `now()`, not null]
Note: 'Stores error reports sent from client applications.'
}
Enum SubscriptionType {
web
fcm
}
Enum PaymentProvider {
STRIPE
PAYPAL
BITCOIN
}
Enum PaymentMethod {
CREDIT_CARD
PAYPAL
BITCOIN
}
Enum PaymentStatus {
INITIATED
PROCESSING
REQUIRES_ACTION
SUCCEEDED
FAILED
CANCELED
}
Enum PaymentSelection {
FULL
PARTIAL
}
Enum Role {
ADMIN
USER
}
Ref: jobs.companyId > companies.id
Ref: job_tags.jobId > jobs.id
Ref: job_tags.tagId > tags.id
Ref: job_metadata.jobId > jobs.id
Ref: taggables.tagId > tags.id
Ref: locations.subscriptionId > subscriptions.id [delete: Cascade]