-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatabase_structure.dbml
469 lines (409 loc) · 7.27 KB
/
database_structure.dbml
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
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
// Drop Dash - Database Structure
// Blogs App
Table Tag {
id uuid [pk]
name varchar
slug slug
is_available base
updated_at base
created_at base
}
Table Post {
id uuid [pk]
title varchar
slug slug
content text
tags M2M
author_id FK
points int
is_featured bool
is_available base
updated_at base
created_at base
}
Ref: Post.tags < Tag.id
Ref: Post.author_id < User.id
Table PostReport {
id uuid [pk]
user_id FK
post_id FK
reason text
priority varchar
status bool
is_available base
updated_at base
created_at base
}
Ref: PostReport.user_id < User.id
Ref: PostReport.post_id < Post.id
// Deliveries App
Table Delivery {
id uuid [pk]
order_id FK
driver_id FK
signature image
status varchar
picked_up_at datetime
delivered_at datetime
is_completed bool
is_available base
updated_at base
created_at base
}
Ref: Delivery.order_id < Order.id
Ref: Delivery.driver_id < Driver.id
Table FailedDelivery {
id uuid [pk]
order_id FK
driver_id FK
reason text
failed_at datetime
is_available base
updated_at base
created_at base
}
Ref: FailedDelivery.order_id < Order.id
Ref: FailedDelivery.driver_id < Driver.id
// Drivers App
Table Driver {
id uuid [pk]
user_id FK
phone varchar
birth_date varchar
driver_license file
identification_document file
social_security_certificate file
criminal_record_certificate file
address varchar
city_id FK
state_id FK
country_id FK
vehicle_type varchar
status bool
is_verified bool
is_available base
updated_at base
created_at base
}
Ref: Driver.user_id < User.id
Ref: Driver.city_id < City.id
Ref: Driver.state_id < State.id
Ref: Driver.country_id < Country.id
Table DriverAssignment {
id uuid [pk]
driver_id FK
order_id FK
assigned_at datetime
status varchar
is_available base
updated_at base
created_at base
}
Ref: DriverAssignment.driver_id < Driver.id
Ref: DriverAssignment.order_id < Order.id
Table Resource {
id uuid [pk]
driver_id FK
resource_type varchar
note text
status varchar
is_available base
updated_at base
created_at base
}
Ref: Resource.driver_id < Driver.id
// Finances App
Table Revenue {
id uuid [pk]
order_id FK
driver_id FK
restaurant_id FK
amount decimal
transaction_type varchar
is_available base
updated_at base
created_at base
}
// Home App
Table Company {
id uuid [pk]
name varchar
logo file
description text
rights varchar
email url
facebook url
twitter url
instagram url
github url
is_available base
updated_at base
created_at base
}
Table Page {
id uuid [pk]
name varchar
content text
is_available base
updated_at base
created_at base
}
Table Keyword {
id uuid [pk]
word varchar
is_available base
updated_at base
created_at base
}
// Jobs App
Table Position {
id uuid [pk]
position varchar
description text
is_available base
updated_at base
created_at base
}
Table Worker {
id uuid [pk]
user_id FK
phone_number varchar
address varchar
city_id FK
state_id FK
country_id FK
position_id FK
hired_date date
termination_date date
hourly_rate decimal
contract_type varchar
status varchar
contract_file file
is_available base
updated_at base
created_at base
}
Ref: Worker.user_id < User.id
Ref: Worker.city_id < City.id
Ref: Worker.state_id < State.id
Ref: Worker.country_id < Country.id
Ref: Worker.position_id < Position.id
Table Applicant {
id uuid [pk]
user_id FK
phone_number varchar
email email
position_id FK
cv file
message text
submitted_at datetime
status varchar
is_available base
updated_at base
created_at base
}
Ref: Applicant.user_id < User.id
Ref: Applicant.position_id < Position.id
// Locations App
Table Country {
id uuid [pk]
name varchar
is_available base
updated_at base
created_at base
}
Table State {
id uuid [pk]
name varchar
country_id FK
is_available base
updated_at base
created_at base
}
Ref: State.country_id < Country.id
Table City {
id uuid [pk]
name varchar
state_id FK
is_available base
updated_at base
created_at base
}
Ref: City.state_id < State.id
// Orders App
Table Order {
id uuid [pk]
user_id FK
shipping_name varchar
shipping_phone varchar
transaction varchar
address_1 varchar
address_2 varchar
city_id FK
state_id FK
country_id FK
note text
restaurant_id FK
amount decimal
status bool
payment_method varchar
is_payment bool
is_valid bool
is_available base
updated_at base
created_at base
}
Ref: Order.user_id < User.id
Ref: Order.city_id < City.id
Ref: Order.state_id < State.id
Ref: Order.country_id < Country.id
Ref: Order.restaurant_id < Restaurant.id
Table OrderItem {
id uuid [pk]
order_id FK
food_id FK
quantity int
price decimal
is_available base
updated_at base
created_at base
}
Ref: OrderItem.order_id < Order.id
Ref: OrderItem.food_id < Food.id
// Promotions App
Table Promotion {
id uuid [pk]
creator_id FK
name varchar
conditions text
start_date date
end_date date
is_active bool
image image
is_available base
updated_at base
created_at base
}
Ref: Promotion.creator_id < User.id
Table FixedCoupon {
id uuid [pk]
name varchar
discount_price decimal
code varchar
start_date date
end_date date
quantity int
is_active bool
is_available base
updated_at base
created_at base
}
Table PercentageCoupon {
id uuid [pk]
name varchar
discount_percentage int
code varchar
start_date date
end_date date
quantity int
is_active bool
is_available base
updated_at base
created_at base
}
// Restaurants App
Table Restaurant {
id uuid [pk]
user_id FK
name varchar
slug slug
image image
banner image
description text
specialty varchar
address varchar
city_id FK
state_id FK
country_id FK
opening_time datetime
closing_time datetime
phone varchar
website url
is_open bool
is_verified bool
banking_certificate file
e_rut file
legal_rep_email file
legal_rep_identity_document file
legal_rep_power_of_attorney file
is_available base
updated_at base
created_at base
}
Ref: Restaurant.user_id < User.id
Ref: Restaurant.city_id < City.id
Ref: Restaurant.state_id < State.id
Ref: Restaurant.country_id < Country.id
Table Category {
id uuid [pk]
name varchar
restaurant_id FK
is_available base
updated_at base
created_at base
}
Ref: Category.restaurant_id < Restaurant.id
Table Food {
id uuid [pk]
name varchar
description text
price decimal
sale_price decimal
image image
restaurant_id FK
category_id FK
is_featured bool
is_available base
updated_at base
created_at base
}
Ref: Food.restaurant_id < Restaurant.id
Ref: Food.category_id < Category.id
// Reviews App
Table Review {
id uuid [pk]
content_type FK
object_id uuid
content_object GFG
user_id FK
rating int
comment text
is_available base
updated_at base
created_at base
}
Ref: Review.content_type < Restaurant.id
Ref: Review.user_id < User.id
// Users App
Table User {
id uuid [pk]
email varchar
username varchar
slug slug
first_name varchar
last_name varchar
date_birth date
points int
role varchar
is_active bool
is_staff bool
created_at date
updated_at date
}
// Utilities App
Table Base {
id uuid [pk]
is_available bool
updated_at datetime
created_at datetime
}