@javalabs/prisma-client 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/CODEOWNERS +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/migrations/add_reserved_amount.sql +8 -0
- package/package.json +4 -5
- package/prisma/schema.prisma +601 -600
- package/.dockerignore +0 -14
- package/Dockerfile +0 -23
- package/prisma/migrations/add_accepts_partial_payments_to_users.sql +0 -19
- package/prisma/migrations/add_amount_received_to_manual_payments.sql +0 -19
- package/prisma/migrations/add_commission_fields.sql +0 -33
- package/prisma/migrations/complete_partial_payments_migration.sql +0 -53
- package/prisma/migrations/create_settlements_table.sql +0 -60
package/prisma/schema.prisma
CHANGED
|
@@ -1,600 +1,601 @@
|
|
|
1
|
-
generator client {
|
|
2
|
-
provider = "prisma-client-js"
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
datasource db {
|
|
6
|
-
provider = "postgresql"
|
|
7
|
-
url = env("DATABASE_URL")
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
model ClientsApiKeys {
|
|
11
|
-
id String @id @default(uuid())
|
|
12
|
-
key String @unique
|
|
13
|
-
clientId String @unique
|
|
14
|
-
clientSecret String @unique
|
|
15
|
-
isActive Boolean @default(true)
|
|
16
|
-
expiresAt DateTime
|
|
17
|
-
createdAt DateTime @default(now())
|
|
18
|
-
updatedAt DateTime @updatedAt
|
|
19
|
-
lastUsedAt DateTime?
|
|
20
|
-
ipWhitelist String[] @default([])
|
|
21
|
-
rateLimit Int? @default(1000) // requests per day
|
|
22
|
-
usage ClientsApiKeyUsage[]
|
|
23
|
-
metadata Json? // Para almacenar información adicional como nombre del cliente, propósito, etc.
|
|
24
|
-
revokedAt DateTime? // Para revocar API keys
|
|
25
|
-
revokedBy String? // Quién revocó la API key
|
|
26
|
-
revokedReason String? // Razón de la revocación
|
|
27
|
-
allowedEndpoints String[] @default([]) // Endpoints permitidos para esta API key
|
|
28
|
-
maxRequestsPerMinute Int? @default(60) // Rate limiting por minuto
|
|
29
|
-
environment String @default("development") // development, staging, production
|
|
30
|
-
version String @default("1.0.0") // Versión de la API key
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
model ClientsApiKeyUsage {
|
|
34
|
-
id String @id @default(uuid())
|
|
35
|
-
apiKeyId String
|
|
36
|
-
clientId String
|
|
37
|
-
ipAddress String
|
|
38
|
-
endpoint String
|
|
39
|
-
method String
|
|
40
|
-
status Int
|
|
41
|
-
usedAt DateTime @default(now())
|
|
42
|
-
apiKey ClientsApiKeys @relation(fields: [apiKeyId], references: [id])
|
|
43
|
-
|
|
44
|
-
@@index([apiKeyId])
|
|
45
|
-
@@index([clientId])
|
|
46
|
-
@@index([usedAt])
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
model api_keys {
|
|
50
|
-
id Int @id @default(autoincrement())
|
|
51
|
-
name String @db.VarChar(255)
|
|
52
|
-
api_key String @unique @db.VarChar(255)
|
|
53
|
-
is_active Boolean? @default(true)
|
|
54
|
-
user_id Int
|
|
55
|
-
provider_id Int?
|
|
56
|
-
providers providers? @relation(fields: [provider_id], references: [provider_id])
|
|
57
|
-
users users @relation(fields: [user_id], references: [user_id], onDelete: NoAction)
|
|
58
|
-
|
|
59
|
-
@@index([id], map: "idx_api_keys_id")
|
|
60
|
-
@@index([provider_id], map: "idx_api_keys_provider_id")
|
|
61
|
-
@@index([user_id], map: "idx_api_keys_user_id")
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
model api_request_logs {
|
|
65
|
-
id Int @id @default(autoincrement())
|
|
66
|
-
api_key String @db.VarChar(255)
|
|
67
|
-
endpoint String @db.VarChar(255)
|
|
68
|
-
ip_address String? @db.VarChar(255)
|
|
69
|
-
user_agent String? @db.VarChar(255)
|
|
70
|
-
request_method String? @db.VarChar(255)
|
|
71
|
-
status_code Int?
|
|
72
|
-
timestamp DateTime? @db.Timestamptz(6)
|
|
73
|
-
|
|
74
|
-
@@index([id], map: "idx_api_request_logs_id")
|
|
75
|
-
@@index([status_code], map: "idx_api_request_logs_status_code")
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
model balances {
|
|
79
|
-
id
|
|
80
|
-
amount
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
@@index([
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
@@index([
|
|
103
|
-
@@index([
|
|
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
|
-
@@index([
|
|
130
|
-
@@index([
|
|
131
|
-
@@index([
|
|
132
|
-
@@index([
|
|
133
|
-
@@index([
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
@@index([
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
@@index([
|
|
166
|
-
@@index([
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
@@index([
|
|
182
|
-
@@index([
|
|
183
|
-
@@index([
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
@@index([
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
@@index([
|
|
212
|
-
@@index([
|
|
213
|
-
@@index([
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
@@
|
|
234
|
-
@@index([
|
|
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
|
-
@@index([
|
|
262
|
-
@@index([
|
|
263
|
-
@@index([
|
|
264
|
-
@@index([
|
|
265
|
-
@@index([
|
|
266
|
-
@@index([
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
@@index([
|
|
284
|
-
@@index([
|
|
285
|
-
@@index([
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
@@index([
|
|
300
|
-
@@index([
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
@@index([
|
|
314
|
-
@@index([
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
@@index([
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
@@
|
|
357
|
-
@@index([
|
|
358
|
-
@@index([
|
|
359
|
-
@@index([
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
@@index([
|
|
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
|
-
@@index([
|
|
414
|
-
@@index([
|
|
415
|
-
@@index([
|
|
416
|
-
@@index([
|
|
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
|
-
@@index([
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
@@index([
|
|
599
|
-
@@index([
|
|
600
|
-
|
|
1
|
+
generator client {
|
|
2
|
+
provider = "prisma-client-js"
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
datasource db {
|
|
6
|
+
provider = "postgresql"
|
|
7
|
+
url = env("DATABASE_URL")
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
model ClientsApiKeys {
|
|
11
|
+
id String @id @default(uuid())
|
|
12
|
+
key String @unique
|
|
13
|
+
clientId String @unique
|
|
14
|
+
clientSecret String @unique
|
|
15
|
+
isActive Boolean @default(true)
|
|
16
|
+
expiresAt DateTime
|
|
17
|
+
createdAt DateTime @default(now())
|
|
18
|
+
updatedAt DateTime @updatedAt
|
|
19
|
+
lastUsedAt DateTime?
|
|
20
|
+
ipWhitelist String[] @default([])
|
|
21
|
+
rateLimit Int? @default(1000) // requests per day
|
|
22
|
+
usage ClientsApiKeyUsage[]
|
|
23
|
+
metadata Json? // Para almacenar información adicional como nombre del cliente, propósito, etc.
|
|
24
|
+
revokedAt DateTime? // Para revocar API keys
|
|
25
|
+
revokedBy String? // Quién revocó la API key
|
|
26
|
+
revokedReason String? // Razón de la revocación
|
|
27
|
+
allowedEndpoints String[] @default([]) // Endpoints permitidos para esta API key
|
|
28
|
+
maxRequestsPerMinute Int? @default(60) // Rate limiting por minuto
|
|
29
|
+
environment String @default("development") // development, staging, production
|
|
30
|
+
version String @default("1.0.0") // Versión de la API key
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
model ClientsApiKeyUsage {
|
|
34
|
+
id String @id @default(uuid())
|
|
35
|
+
apiKeyId String
|
|
36
|
+
clientId String
|
|
37
|
+
ipAddress String
|
|
38
|
+
endpoint String
|
|
39
|
+
method String
|
|
40
|
+
status Int
|
|
41
|
+
usedAt DateTime @default(now())
|
|
42
|
+
apiKey ClientsApiKeys @relation(fields: [apiKeyId], references: [id])
|
|
43
|
+
|
|
44
|
+
@@index([apiKeyId])
|
|
45
|
+
@@index([clientId])
|
|
46
|
+
@@index([usedAt])
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
model api_keys {
|
|
50
|
+
id Int @id @default(autoincrement())
|
|
51
|
+
name String @db.VarChar(255)
|
|
52
|
+
api_key String @unique @db.VarChar(255)
|
|
53
|
+
is_active Boolean? @default(true)
|
|
54
|
+
user_id Int
|
|
55
|
+
provider_id Int?
|
|
56
|
+
providers providers? @relation(fields: [provider_id], references: [provider_id])
|
|
57
|
+
users users @relation(fields: [user_id], references: [user_id], onDelete: NoAction)
|
|
58
|
+
|
|
59
|
+
@@index([id], map: "idx_api_keys_id")
|
|
60
|
+
@@index([provider_id], map: "idx_api_keys_provider_id")
|
|
61
|
+
@@index([user_id], map: "idx_api_keys_user_id")
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
model api_request_logs {
|
|
65
|
+
id Int @id @default(autoincrement())
|
|
66
|
+
api_key String @db.VarChar(255)
|
|
67
|
+
endpoint String @db.VarChar(255)
|
|
68
|
+
ip_address String? @db.VarChar(255)
|
|
69
|
+
user_agent String? @db.VarChar(255)
|
|
70
|
+
request_method String? @db.VarChar(255)
|
|
71
|
+
status_code Int?
|
|
72
|
+
timestamp DateTime? @db.Timestamptz(6)
|
|
73
|
+
|
|
74
|
+
@@index([id], map: "idx_api_request_logs_id")
|
|
75
|
+
@@index([status_code], map: "idx_api_request_logs_status_code")
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
model balances {
|
|
79
|
+
id Int @id @default(autoincrement())
|
|
80
|
+
amount Decimal @db.Decimal(10, 2)
|
|
81
|
+
reserved_amount Decimal @default(0.00) @db.Decimal(10, 2)
|
|
82
|
+
currency String @db.VarChar(10)
|
|
83
|
+
user_id Int
|
|
84
|
+
createdAt DateTime @db.Timestamptz(6)
|
|
85
|
+
updatedAt DateTime @db.Timestamptz(6)
|
|
86
|
+
isDeleted Boolean @default(false)
|
|
87
|
+
deletedAt DateTime? @db.Timestamptz(6)
|
|
88
|
+
users users @relation(fields: [user_id], references: [user_id], onDelete: NoAction)
|
|
89
|
+
|
|
90
|
+
@@index([id], map: "idx_balances_id")
|
|
91
|
+
@@index([user_id], map: "idx_balances_user_id")
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
model banks {
|
|
95
|
+
id Int @id @default(autoincrement())
|
|
96
|
+
name String @db.VarChar(100)
|
|
97
|
+
code String? @db.VarChar(100)
|
|
98
|
+
country_code String? @db.VarChar(100)
|
|
99
|
+
createdAt DateTime @db.Timestamptz(6)
|
|
100
|
+
updatedAt DateTime @db.Timestamptz(6)
|
|
101
|
+
|
|
102
|
+
@@index([code], map: "idx_banks_code")
|
|
103
|
+
@@index([country_code], map: "idx_banks_country_code")
|
|
104
|
+
@@index([id], map: "idx_banks_id")
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
model charges {
|
|
108
|
+
id Int @id @default(autoincrement())
|
|
109
|
+
token String @db.VarChar(255)
|
|
110
|
+
order_id String @unique(map: "charges_order_id") @db.VarChar(255)
|
|
111
|
+
amount Decimal @db.Decimal(10, 2)
|
|
112
|
+
vat_amount Decimal @db.Decimal(10, 2)
|
|
113
|
+
description String @db.VarChar(255)
|
|
114
|
+
user_type enum_charges_user_type
|
|
115
|
+
document_type enum_charges_document_type
|
|
116
|
+
bank_code String @db.VarChar(255)
|
|
117
|
+
status String @db.VarChar(255)
|
|
118
|
+
buyer_email String @db.VarChar(255)
|
|
119
|
+
buyer_full_name String @db.VarChar(255)
|
|
120
|
+
document_number String @db.VarChar(255)
|
|
121
|
+
redirect_url String @default("https://dashboard.tupay.finance") @db.VarChar(255)
|
|
122
|
+
traceability_code String? @db.VarChar(255)
|
|
123
|
+
return_code String? @db.VarChar(255)
|
|
124
|
+
bank_url String? @db.VarChar(255)
|
|
125
|
+
buyer_phone_number String @db.VarChar(255)
|
|
126
|
+
transaction_state String? @db.VarChar(255)
|
|
127
|
+
created_at DateTime? @db.Timestamptz(6)
|
|
128
|
+
|
|
129
|
+
@@index([bank_code], map: "idx_charges_bank_code")
|
|
130
|
+
@@index([created_at], map: "idx_charges_created_at")
|
|
131
|
+
@@index([id], map: "idx_charges_id")
|
|
132
|
+
@@index([order_id], map: "idx_charges_order_id")
|
|
133
|
+
@@index([return_code], map: "idx_charges_return_code")
|
|
134
|
+
@@index([traceability_code], map: "idx_charges_traceability_code")
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
model countries {
|
|
138
|
+
id Int @id @default(autoincrement())
|
|
139
|
+
name String @db.VarChar(100)
|
|
140
|
+
code String @unique @db.VarChar(3)
|
|
141
|
+
currencyCode String @unique @db.VarChar(3)
|
|
142
|
+
image String?
|
|
143
|
+
createdAt DateTime @db.Timestamptz(6)
|
|
144
|
+
updatedAt DateTime @db.Timestamptz(6)
|
|
145
|
+
manual_transfer_bank_acounts manual_transfer_bank_acounts[]
|
|
146
|
+
providers providers[]
|
|
147
|
+
users users[]
|
|
148
|
+
transactions transactions[]
|
|
149
|
+
|
|
150
|
+
@@index([code], map: "idx_countries_code")
|
|
151
|
+
@@index([id], map: "idx_countries_id")
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
model credit_requests {
|
|
155
|
+
id Int @id @default(autoincrement())
|
|
156
|
+
user_id Int?
|
|
157
|
+
invoice_id Int?
|
|
158
|
+
amount Decimal @db.Decimal(10, 2)
|
|
159
|
+
status enum_transaction_status @default(pending)
|
|
160
|
+
requested_at DateTime @db.Timestamptz(6)
|
|
161
|
+
processed_at DateTime? @db.Timestamptz(6)
|
|
162
|
+
invoices invoices? @relation(fields: [invoice_id], references: [id])
|
|
163
|
+
users users? @relation(fields: [user_id], references: [user_id])
|
|
164
|
+
|
|
165
|
+
@@index([id], map: "idx_credit_requests_id")
|
|
166
|
+
@@index([invoice_id], map: "idx_credit_requests_invoice_id")
|
|
167
|
+
@@index([user_id], map: "idx_credit_requests_user_id")
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
model customers {
|
|
171
|
+
id Int @id @default(autoincrement())
|
|
172
|
+
custom_id String? @unique @db.VarChar(255)
|
|
173
|
+
mail String @unique @db.VarChar(255)
|
|
174
|
+
name String @db.VarChar(255)
|
|
175
|
+
phone_number String @db.VarChar(255)
|
|
176
|
+
created_at DateTime @db.Timestamptz(6)
|
|
177
|
+
user_id Int
|
|
178
|
+
updatedAt DateTime @db.Timestamptz(6)
|
|
179
|
+
users users @relation(fields: [user_id], references: [user_id], onDelete: NoAction)
|
|
180
|
+
|
|
181
|
+
@@index([created_at], map: "idx_customers_created_at")
|
|
182
|
+
@@index([custom_id], map: "idx_customers_custom_id")
|
|
183
|
+
@@index([id], map: "idx_customers_id")
|
|
184
|
+
@@index([user_id], map: "idx_customers_user_id")
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
model daily_logs {
|
|
188
|
+
id Int @id @default(autoincrement())
|
|
189
|
+
log_date DateTime @db.Timestamptz(6)
|
|
190
|
+
details String? @db.VarChar(255)
|
|
191
|
+
transaction_id Int?
|
|
192
|
+
transactions transactions? @relation(fields: [transaction_id], references: [id])
|
|
193
|
+
|
|
194
|
+
@@index([id], map: "idx_daily_logs_id")
|
|
195
|
+
@@index([transaction_id], map: "idx_daily_logs_transaction_id")
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
model global_user_transactions {
|
|
199
|
+
id Int @id @default(autoincrement())
|
|
200
|
+
transaction_type enum_transaction_type
|
|
201
|
+
amount Decimal @db.Decimal(10, 2)
|
|
202
|
+
status enum_transaction_status
|
|
203
|
+
executed_at DateTime? @db.Timestamptz(6)
|
|
204
|
+
user_id Int?
|
|
205
|
+
transaction_id Int?
|
|
206
|
+
provider_id Int?
|
|
207
|
+
providers providers? @relation(fields: [provider_id], references: [provider_id])
|
|
208
|
+
transactions transactions? @relation(fields: [transaction_id], references: [id])
|
|
209
|
+
users users? @relation(fields: [user_id], references: [user_id])
|
|
210
|
+
|
|
211
|
+
@@index([id], map: "idx_global_user_transactions_id")
|
|
212
|
+
@@index([provider_id], map: "idx_global_user_transactions_provider_id")
|
|
213
|
+
@@index([transaction_id], map: "idx_global_user_transactions_transaction_id")
|
|
214
|
+
@@index([user_id], map: "idx_global_user_transactions_user_id")
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
model invoices {
|
|
218
|
+
id Int @id @default(autoincrement())
|
|
219
|
+
invoice_number BigInt
|
|
220
|
+
transaction_id Int?
|
|
221
|
+
reference BigInt @unique
|
|
222
|
+
amount Decimal @db.Decimal(10, 2)
|
|
223
|
+
currency String @db.VarChar(255)
|
|
224
|
+
status enum_transaction_status @default(pending)
|
|
225
|
+
link_payment String? @db.VarChar(255)
|
|
226
|
+
due_date DateTime? @db.Timestamptz(6)
|
|
227
|
+
is_paid Boolean @default(false)
|
|
228
|
+
createdAt DateTime @db.Timestamptz(6)
|
|
229
|
+
updatedAt DateTime @db.Timestamptz(6)
|
|
230
|
+
credit_requests credit_requests[]
|
|
231
|
+
transactions transactions? @relation(fields: [transaction_id], references: [id])
|
|
232
|
+
|
|
233
|
+
@@unique([id, transaction_id], map: "invoices_id_transaction_id")
|
|
234
|
+
@@index([id], map: "idx_invoices_id")
|
|
235
|
+
@@index([transaction_id], map: "idx_invoices_transaction_id")
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
model manual_payments {
|
|
239
|
+
id Int @id @default(autoincrement())
|
|
240
|
+
user_id Int
|
|
241
|
+
amount Decimal @db.Decimal(10, 2)
|
|
242
|
+
amount_received Decimal? @db.Decimal(10, 2)
|
|
243
|
+
currency String @db.VarChar(10)
|
|
244
|
+
bank_transaction_id Int?
|
|
245
|
+
receipt_image_url String? @db.Text
|
|
246
|
+
notes String?
|
|
247
|
+
status enum_transaction_status @default(pending)
|
|
248
|
+
admin_notes String?
|
|
249
|
+
processed_by Int?
|
|
250
|
+
processed_by_type String? @default("user") @db.VarChar(255)
|
|
251
|
+
created_at DateTime @db.Timestamptz(6)
|
|
252
|
+
processed_at DateTime? @db.Timestamptz(6)
|
|
253
|
+
country_code String? @db.VarChar(10)
|
|
254
|
+
bank_account_id Int?
|
|
255
|
+
transaction_id Int?
|
|
256
|
+
transaction transactions? @relation(fields: [transaction_id], references: [id])
|
|
257
|
+
manual_transfer_bank_acounts manual_transfer_bank_acounts? @relation(fields: [bank_account_id], references: [id])
|
|
258
|
+
users_manual_payments_processed_byTousers users? @relation("manual_payments_processed_byTousers", fields: [processed_by], references: [user_id])
|
|
259
|
+
users_manual_payments_user_idTousers users @relation("manual_payments_user_idTousers", fields: [user_id], references: [user_id])
|
|
260
|
+
|
|
261
|
+
@@index([bank_account_id], map: "idx_manual_payments_bank_account_id")
|
|
262
|
+
@@index([bank_transaction_id], map: "idx_manual_payments_bank_transaction_id")
|
|
263
|
+
@@index([country_code], map: "idx_manual_payments_country_code")
|
|
264
|
+
@@index([created_at], map: "idx_manual_payments_created_at")
|
|
265
|
+
@@index([id], map: "idx_manual_payments_id")
|
|
266
|
+
@@index([processed_by], map: "idx_manual_payments_processed_by")
|
|
267
|
+
@@index([user_id], map: "idx_manual_payments_user_id")
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
model manual_transfer_bank_acounts {
|
|
271
|
+
id Int @id @default(autoincrement())
|
|
272
|
+
method_name String? @db.VarChar(255)
|
|
273
|
+
account_number String @db.VarChar(255)
|
|
274
|
+
account_type String @db.VarChar(255)
|
|
275
|
+
bank_name String @db.VarChar(255)
|
|
276
|
+
bank_owner_name String? @db.VarChar(255)
|
|
277
|
+
country_code String @db.VarChar(255)
|
|
278
|
+
created_at DateTime @db.Timestamptz(6)
|
|
279
|
+
updated_at DateTime @db.Timestamptz(6)
|
|
280
|
+
manual_payments manual_payments[]
|
|
281
|
+
countries countries @relation(fields: [country_code], references: [code])
|
|
282
|
+
|
|
283
|
+
@@index([country_code], map: "idx_manual_transfer_bank_acounts_country_code")
|
|
284
|
+
@@index([created_at], map: "idx_manual_transfer_bank_acounts_created_at")
|
|
285
|
+
@@index([id], map: "idx_manual_transfer_bank_acounts_id")
|
|
286
|
+
@@index([updated_at], map: "idx_manual_transfer_bank_acounts_updated_at")
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
model notifications {
|
|
290
|
+
id Int @id @default(autoincrement())
|
|
291
|
+
message String @db.VarChar(255)
|
|
292
|
+
notification_date DateTime? @db.Timestamptz(6)
|
|
293
|
+
metadata Json?
|
|
294
|
+
user_id Int?
|
|
295
|
+
transaction_id Int?
|
|
296
|
+
transactions transactions? @relation(fields: [transaction_id], references: [id])
|
|
297
|
+
users users? @relation(fields: [user_id], references: [user_id])
|
|
298
|
+
|
|
299
|
+
@@index([id], map: "idx_notifications_id")
|
|
300
|
+
@@index([transaction_id], map: "idx_notifications_transaction_id")
|
|
301
|
+
@@index([user_id], map: "idx_notifications_user_id")
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
model pending_references {
|
|
305
|
+
id Int @id @default(autoincrement())
|
|
306
|
+
status enum_transaction_status
|
|
307
|
+
reference_date DateTime? @db.Timestamptz(6)
|
|
308
|
+
user_id Int?
|
|
309
|
+
provider_id Int?
|
|
310
|
+
providers providers? @relation(fields: [provider_id], references: [provider_id])
|
|
311
|
+
users users? @relation(fields: [user_id], references: [user_id])
|
|
312
|
+
|
|
313
|
+
@@index([id], map: "idx_pending_references_id")
|
|
314
|
+
@@index([provider_id], map: "idx_pending_references_provider_id")
|
|
315
|
+
@@index([user_id], map: "idx_pending_references_user_id")
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
model providers {
|
|
319
|
+
provider_id Int @id @default(autoincrement())
|
|
320
|
+
name String @db.VarChar(255)
|
|
321
|
+
contact_email String? @db.VarChar(255)
|
|
322
|
+
api_key String @unique @db.VarChar(255)
|
|
323
|
+
is_active Boolean? @default(true)
|
|
324
|
+
country_id Int
|
|
325
|
+
agreement String? @db.VarChar(50)
|
|
326
|
+
image String?
|
|
327
|
+
api_keys api_keys[]
|
|
328
|
+
global_user_transactions global_user_transactions[]
|
|
329
|
+
pending_references pending_references[]
|
|
330
|
+
countries countries @relation(fields: [country_id], references: [id], onDelete: Cascade)
|
|
331
|
+
transactions transactions[]
|
|
332
|
+
|
|
333
|
+
@@index([country_id], map: "idx_providers_country_id")
|
|
334
|
+
@@index([provider_id], map: "idx_providers_provider_id")
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
model toku {
|
|
338
|
+
id Int @id @default(autoincrement())
|
|
339
|
+
customer String @unique @db.VarChar(255)
|
|
340
|
+
subscription String? @unique @db.VarChar(255)
|
|
341
|
+
invoice String? @unique @db.VarChar(255)
|
|
342
|
+
product_id String? @unique @db.VarChar(255)
|
|
343
|
+
is_paid Boolean? @default(false)
|
|
344
|
+
mail String @unique @db.VarChar(50)
|
|
345
|
+
name String @db.VarChar(50)
|
|
346
|
+
phone_number String @db.VarChar(50)
|
|
347
|
+
amount Decimal? @db.Decimal(10, 2)
|
|
348
|
+
currency String? @db.VarChar(255)
|
|
349
|
+
status enum_toku_status? @default(pending)
|
|
350
|
+
link_payment String? @db.VarChar(255)
|
|
351
|
+
due_date DateTime? @db.Timestamptz(6)
|
|
352
|
+
transaction_id Int? @unique
|
|
353
|
+
created_at DateTime? @db.Timestamptz(6)
|
|
354
|
+
transactions transactions? @relation(fields: [transaction_id], references: [id])
|
|
355
|
+
|
|
356
|
+
@@unique([id, transaction_id], map: "toku_id_transaction_id")
|
|
357
|
+
@@index([created_at], map: "idx_toku_created_at")
|
|
358
|
+
@@index([id], map: "idx_toku_id")
|
|
359
|
+
@@index([product_id], map: "idx_toku_product_id")
|
|
360
|
+
@@index([transaction_id], map: "idx_toku_transaction_id")
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
model transaction_updates {
|
|
364
|
+
id Int @id @default(autoincrement())
|
|
365
|
+
new_status enum_transaction_status
|
|
366
|
+
update_date DateTime? @db.Timestamptz(6)
|
|
367
|
+
transaction_id Int?
|
|
368
|
+
transactions transactions? @relation(fields: [transaction_id], references: [id])
|
|
369
|
+
|
|
370
|
+
@@index([id], map: "idx_transaction_updates_id")
|
|
371
|
+
@@index([transaction_id], map: "idx_transaction_updates_transaction_id")
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
model transactions {
|
|
375
|
+
id Int @id @default(autoincrement())
|
|
376
|
+
uuid String? @unique
|
|
377
|
+
reference BigInt @unique
|
|
378
|
+
currency String @db.VarChar(10)
|
|
379
|
+
country_id Int?
|
|
380
|
+
amount Decimal @db.Decimal(10, 2)
|
|
381
|
+
transaction_type enum_transaction_type
|
|
382
|
+
user_name String @db.VarChar(50)
|
|
383
|
+
user_phone String @db.VarChar(20)
|
|
384
|
+
user_email String @db.VarChar(50)
|
|
385
|
+
user_bank String @db.VarChar(50)
|
|
386
|
+
user_type_account enum_account_type
|
|
387
|
+
user_num_account String @db.VarChar(20)
|
|
388
|
+
user_identification_number String @db.VarChar(255)
|
|
389
|
+
status enum_transaction_status
|
|
390
|
+
user_id Int?
|
|
391
|
+
provider_id Int?
|
|
392
|
+
createdAt DateTime @db.Timestamptz(6)
|
|
393
|
+
updatedAt DateTime @db.Timestamptz(6)
|
|
394
|
+
bank_name String? @db.VarChar(100)
|
|
395
|
+
account_number String? @db.VarChar(50)
|
|
396
|
+
custom_id String? @db.VarChar(255)
|
|
397
|
+
commission Decimal? @default(0) @db.Decimal(10, 2)
|
|
398
|
+
fixed_fee Decimal? @default(0) @db.Decimal(10, 2)
|
|
399
|
+
total_commission_fee Decimal? @default(0) @db.Decimal(10, 2)
|
|
400
|
+
total_operation Decimal? @default(0) @db.Decimal(10, 2)
|
|
401
|
+
toku toku?
|
|
402
|
+
account_type enum_account_type?
|
|
403
|
+
daily_logs daily_logs[]
|
|
404
|
+
global_user_transactions global_user_transactions[]
|
|
405
|
+
invoices invoices[]
|
|
406
|
+
notifications notifications[]
|
|
407
|
+
transaction_updates transaction_updates[]
|
|
408
|
+
manual_payments manual_payments[]
|
|
409
|
+
providers providers? @relation(fields: [provider_id], references: [provider_id])
|
|
410
|
+
users users? @relation(fields: [user_id], references: [user_id])
|
|
411
|
+
countries countries? @relation(fields: [country_id], references: [id])
|
|
412
|
+
|
|
413
|
+
@@index([custom_id], map: "idx_transactions_custom_id")
|
|
414
|
+
@@index([id], map: "idx_transactions_id")
|
|
415
|
+
@@index([provider_id], map: "idx_transactions_provider_id")
|
|
416
|
+
@@index([user_id], map: "idx_transactions_user_id")
|
|
417
|
+
@@index([uuid], map: "idx_transactions_uuid")
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
model users {
|
|
421
|
+
user_id Int @id @default(autoincrement())
|
|
422
|
+
name String @db.VarChar(255)
|
|
423
|
+
email String @unique(map: "idx_users_email") @db.VarChar(255)
|
|
424
|
+
password String @db.VarChar(255)
|
|
425
|
+
onboarding_date DateTime? @db.Timestamptz(6)
|
|
426
|
+
role enum_users_role
|
|
427
|
+
status enum_users_status? @default(active)
|
|
428
|
+
country_id Int
|
|
429
|
+
createdAt DateTime @db.Timestamptz(6)
|
|
430
|
+
updatedAt DateTime @db.Timestamptz(6)
|
|
431
|
+
payInWebhookUrl String?
|
|
432
|
+
payOutWebhookUrl String?
|
|
433
|
+
payInRedirectUrl String?
|
|
434
|
+
payOutRedirectUrl String?
|
|
435
|
+
payin_commission_percent Decimal? @default(0) @db.Decimal(5, 2)
|
|
436
|
+
payin_fixed_fee Decimal? @default(0) @db.Decimal(10, 2)
|
|
437
|
+
payout_fixed_fee Decimal? @default(0) @db.Decimal(10, 2)
|
|
438
|
+
accepts_partial_payments Boolean? @default(false)
|
|
439
|
+
api_keys api_keys[]
|
|
440
|
+
balances balances[]
|
|
441
|
+
credit_requests credit_requests[]
|
|
442
|
+
customers customers[]
|
|
443
|
+
global_user_transactions global_user_transactions[]
|
|
444
|
+
manual_payments_manual_payments_processed_byTousers manual_payments[] @relation("manual_payments_processed_byTousers")
|
|
445
|
+
manual_payments_manual_payments_user_idTousers manual_payments[] @relation("manual_payments_user_idTousers")
|
|
446
|
+
notifications notifications[]
|
|
447
|
+
pending_references pending_references[]
|
|
448
|
+
transactions transactions[]
|
|
449
|
+
settlements settlements[]
|
|
450
|
+
countries countries @relation(fields: [country_id], references: [id], onDelete: Cascade)
|
|
451
|
+
isDeleted Boolean @default(false)
|
|
452
|
+
deletedAt DateTime? @db.Timestamptz(6)
|
|
453
|
+
reset_token String? @db.VarChar(255)
|
|
454
|
+
reset_token_expiry DateTime? @db.Timestamp
|
|
455
|
+
|
|
456
|
+
@@index([country_id], map: "idx_users_country_id")
|
|
457
|
+
@@index([user_id], map: "idx_users_user_id")
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
enum enum_account_type {
|
|
461
|
+
checking
|
|
462
|
+
savings
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
enum enum_charges_document_type {
|
|
466
|
+
CC
|
|
467
|
+
CE
|
|
468
|
+
NIT
|
|
469
|
+
TI
|
|
470
|
+
PP
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
enum enum_charges_user_type {
|
|
474
|
+
NATURAL
|
|
475
|
+
LEGAL
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
enum enum_toku_status {
|
|
479
|
+
pending
|
|
480
|
+
paid
|
|
481
|
+
failed
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
enum enum_transaction_status {
|
|
485
|
+
pending
|
|
486
|
+
approved
|
|
487
|
+
rejected
|
|
488
|
+
paid
|
|
489
|
+
completed
|
|
490
|
+
failed
|
|
491
|
+
canceled
|
|
492
|
+
processed
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
enum enum_transaction_type {
|
|
496
|
+
payin
|
|
497
|
+
payout
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
enum enum_users_role {
|
|
501
|
+
user
|
|
502
|
+
admin
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
enum enum_users_status {
|
|
506
|
+
active
|
|
507
|
+
inactive
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
enum enum_credit_requests_status {
|
|
511
|
+
pending
|
|
512
|
+
approved
|
|
513
|
+
rejected
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
enum enum_global_user_transactions_status {
|
|
517
|
+
pending
|
|
518
|
+
approved
|
|
519
|
+
rejected
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
enum enum_global_user_transactions_transaction_type {
|
|
523
|
+
payin
|
|
524
|
+
payout
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
enum enum_invoices_status {
|
|
528
|
+
pending
|
|
529
|
+
paid
|
|
530
|
+
failed
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
enum enum_pending_references_status {
|
|
534
|
+
pending
|
|
535
|
+
processed
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
enum enum_transaction_updates_new_status {
|
|
539
|
+
approved
|
|
540
|
+
rejected
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
enum enum_transactions_account_type {
|
|
544
|
+
checking
|
|
545
|
+
savings
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
enum enum_transactions_status {
|
|
549
|
+
pending
|
|
550
|
+
approved
|
|
551
|
+
rejected
|
|
552
|
+
paid
|
|
553
|
+
completed
|
|
554
|
+
failed
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
enum enum_transactions_transaction_type {
|
|
558
|
+
payin
|
|
559
|
+
payout
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
enum enum_transactions_user_type_account {
|
|
563
|
+
checking
|
|
564
|
+
savings
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
enum enum_settlements_status {
|
|
568
|
+
pending
|
|
569
|
+
completed
|
|
570
|
+
cancelled
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
model settlements {
|
|
574
|
+
id Int @id @default(autoincrement())
|
|
575
|
+
user_id Int
|
|
576
|
+
settlement_date DateTime @db.Timestamptz(6)
|
|
577
|
+
period_start DateTime @db.Timestamptz(6)
|
|
578
|
+
period_end DateTime @db.Timestamptz(6)
|
|
579
|
+
payin_count Int @default(0)
|
|
580
|
+
payin_total_amount Decimal @default(0) @db.Decimal(15, 2)
|
|
581
|
+
payin_total_commission Decimal @default(0) @db.Decimal(15, 2)
|
|
582
|
+
payin_net_amount Decimal @default(0) @db.Decimal(15, 2)
|
|
583
|
+
payout_count Int @default(0)
|
|
584
|
+
payout_total_amount Decimal @default(0) @db.Decimal(15, 2)
|
|
585
|
+
payout_total_commission Decimal @default(0) @db.Decimal(15, 2)
|
|
586
|
+
payout_total_with_commission Decimal @default(0) @db.Decimal(15, 2)
|
|
587
|
+
total_commission Decimal @default(0) @db.Decimal(15, 2)
|
|
588
|
+
balance_before Decimal @default(0) @db.Decimal(15, 2)
|
|
589
|
+
settlement_amount Decimal @default(0) @db.Decimal(15, 2)
|
|
590
|
+
balance_after Decimal @default(0) @db.Decimal(15, 2)
|
|
591
|
+
status enum_settlements_status @default(pending)
|
|
592
|
+
notes String? @db.Text
|
|
593
|
+
currency String @default("USD") @db.VarChar(3)
|
|
594
|
+
created_at DateTime @default(now()) @db.Timestamptz(6)
|
|
595
|
+
updated_at DateTime @updatedAt @db.Timestamptz(6)
|
|
596
|
+
users users @relation(fields: [user_id], references: [user_id], onDelete: Cascade)
|
|
597
|
+
|
|
598
|
+
@@index([user_id], map: "idx_settlements_user_id")
|
|
599
|
+
@@index([period_start, period_end], map: "idx_settlements_period")
|
|
600
|
+
@@index([settlement_date], map: "idx_settlements_date")
|
|
601
|
+
}
|