forked from motor-admin/motor-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmotor-admin.yml
More file actions
2936 lines (2934 loc) · 137 KB
/
motor-admin.yml
File metadata and controls
2936 lines (2934 loc) · 137 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
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
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
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
engine_version: 0.4.21
file_version: 2025-11-25 19:39:02.070966000 Z
resources:
- name: account
preferences:
custom_sql: "SELECT account.id, account.account_number, account.type::text ~*
'investor' as is_investor, (SELECT COUNT(*) FROM transaction t WHERE t.investor_id
= account.id AND t.type = 'contribution' AND t.status NOT IN ('cancelled', 'rejected'))
as contributions, (SELECT COUNT(a.id) FROM account a WHERE a.referrer_account_id
= account.id) as referred, account.account_number, account.type as account_type,
entity_profile.name as entity_name, CONCAT_WS(' ', \n NULLIF(TRIM((entity_profile.company_address->>'unit')::text),
''),\n NULLIF(TRIM((entity_profile.company_address->>'street')::text), ''),\n
\ NULLIF(TRIM((entity_profile.company_address->>'city')::text), ''),\n NULLIF(TRIM((entity_profile.company_address->>'province')::text),
''),\n NULLIF(TRIM((entity_profile.company_address->>'postalCode')::text),
''),\n NULLIF(TRIM((entity_profile.company_address->>'country')::text), '')\n)
as entity_company_address, account.is_referral_agent, account.referral_agent_effective_date,
account.status, pu.first_name as primary_user_first_name, \npu.last_name as
primary_user_last_name, \npu.date_of_birth as primary_user_date_of_birth, \npu.email
as primary_user_email, \npu.phone as primary_user_phone,\npu.sin as primary_user_sin,\nCONCAT_WS('
', \n NULLIF(TRIM((pu.residential_address->>'unit')::text), ''),\n NULLIF(TRIM((pu.residential_address->>'street')::text),
''),\n NULLIF(TRIM((pu.residential_address->>'city')::text), ''),\n NULLIF(TRIM((pu.residential_address->>'province')::text),
''),\n NULLIF(TRIM((pu.residential_address->>'postalCode')::text), ''),\n
\ NULLIF(TRIM((pu.residential_address->>'country')::text), '')\n) as primary_user_residential_address,\n(kyc_pu.provider<>''AND
kyc_pu.provider IS NOT NULL AND account.type::text ~* 'investor' AND (SELECT
COUNT(*) FROM transaction t WHERE t.investor_id = account.id AND t.type = 'contribution'
AND t.status NOT IN ('cancelled', 'rejected')) = 0) AS kycd_not_invested,\n(kyc_pu.status
= 'pending' AND account.type::text ~* 'investor' AND (SELECT COUNT(*) FROM transaction
t WHERE t.investor_id = account.id AND t.type = 'contribution' AND t.status
NOT IN ('cancelled', 'rejected')) = 0) AS pending_kyc_not_invested,\nkyc_pu.provider
AS primary_user_kyc_provider,\n\tnote_pu.content as primary_user_kyc_note,\n\tkyc_pu.status
AS primary_user_kyc_provider_status,\n\tkyc_pu.status AS primary_user_kyc_questions_review_status,\nkyc_pu.kyc_hits_review_status
AS primary_user_kyc_hits_review_status,\n\tkyc_pu.document_type AS primary_user_document_type,\n\tkyc_pu.document_number
AS primary_user_document_number,\n\tkyc_pu.document_valid_from AS primary_user_document_valid_from,\n\tkyc_pu.document_valid_to
AS primary_user_document_valid_to,\n\tkyc_pu.document_country AS primary_user_document_country,\nEXISTS
(\n SELECT 1\n FROM jsonb_array_elements(kyc_pu.veriff_report -> 'pepAndSanctions'
-> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'pep' -> 0 IS
NOT NULL\n) OR (kyc_pu.onfido_report -> 'reports' -> 1 -> 'breakdown' -> 'politically_exposed_person'
->> 'result' != 'clear') AS primary_user_kyc_pep_hit,\nEXISTS (\n SELECT 1\n
\ FROM jsonb_array_elements(kyc_pu.veriff_report -> 'pepAndSanctions' -> 'hits')
AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'sanctions' -> 0 IS NOT
NULL\n) OR (kyc_pu.onfido_report -> 'reports' -> 1 -> 'breakdown' -> 'sanction'
->> 'result' != 'clear') AS primary_user_kyc_sanctions_hit,\n EXISTS (\n SELECT
1 \n FROM jsonb_array_elements(kyc_pu.veriff_report -> 'pepAndSanctions' ->
'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'warnings' -> 0
IS NOT NULL\n) OR (kyc_pu.onfido_report -> 'reports' -> 1 -> 'breakdown' ->
'legal_and_regulatory_warnings' ->> 'result' != 'clear') AS primary_user_kyc_warnings_hit,\nEXISTS
(\n SELECT 1\n FROM jsonb_array_elements(kyc_pu.veriff_report -> 'pepAndSanctions'
-> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'fitnessProbity'
-> 0 IS NOT NULL\n) AS primary_user_kyc_fitness_probity_hit,\nju.first_name
as joint_user_first_name, ju.last_name as joint_user_last_name,\nju.date_of_birth
as joint_user_date_of_birth,\nju.email as joint_user_email,\nju.phone as joint_user_phone,\nkyc_ju.provider
AS joint_user_kyc_provider,\n\tnote_ju.content as joint_user_kyc_note,\n\tkyc_ju.status
AS joint_user_kyc_provider_status,\n\tkyc_ju.status AS joint_user_kyc_questions_review_status,\nkyc_ju.kyc_hits_review_status
AS joint_user_kyc_hits_review_status,\n\tkyc_ju.document_type AS joint_user_document_type,\n\tkyc_ju.document_number
AS joint_user_document_number,\n\tkyc_ju.document_valid_from AS joint_user_document_valid_from,\n\tkyc_ju.document_valid_to
AS joint_user_document_valid_to,\n\tkyc_ju.document_country AS joint_user_document_country,\nEXISTS
(\n SELECT 1\n FROM jsonb_array_elements(kyc_ju.veriff_report -> 'pepAndSanctions'
-> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'pep' -> 0 IS
NOT NULL\n) OR (kyc_ju.onfido_report -> 'reports' -> 1 -> 'breakdown' -> 'politically_exposed_person'
->> 'result' != 'clear') AS joint_user_kyc_pep_hit,\nEXISTS (\n SELECT 1\n
\ FROM jsonb_array_elements(kyc_ju.veriff_report -> 'pepAndSanctions' -> 'hits')
AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'sanctions' -> 0 IS NOT
NULL\n) OR (kyc_ju.onfido_report -> 'reports' -> 1 -> 'breakdown' -> 'sanction'
->> 'result' != 'clear') AS joint_user_kyc_sanctions_hit,\n EXISTS (\n SELECT
1 \n FROM jsonb_array_elements(kyc_ju.veriff_report -> 'pepAndSanctions' ->
'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'warnings' -> 0
IS NOT NULL\n) OR (kyc_ju.onfido_report -> 'reports' -> 1 -> 'breakdown' ->
'legal_and_regulatory_warnings' ->> 'result' != 'clear') AS joint_user_kyc_warnings_hit,\nEXISTS
(\n SELECT 1\n FROM jsonb_array_elements(kyc_ju.veriff_report -> 'pepAndSanctions'
-> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'fitnessProbity'
-> 0 IS NOT NULL\n) AS joint_user_kyc_fitness_probity_hit,\naccount.referrer_account_id,\naccount.referrer_account_user_id,\naccount.suitability
->> 'aum' AS aum,\n account.suitability ->> 'is_broker' AS is_broker,\n account.suitability
->> 'risk_level' AS risk_level,\n account.suitability ->> 'updated_at' AS updated_at,\n
\ account.suitability ->> 'is_registrant' AS is_registrant,\n account.suitability
->> 'risk_capacity' AS risk_capacity,\n account.suitability ->> 'risk_tolerance'
AS risk_tolerance,\n account.suitability -> 'asset_allocation' AS asset_allocation,\n
\ account.suitability ->> 'investment_horizon' AS investment_horizon,\n account.suitability
->> 'investment_knowledge' AS investment_knowledge,\n account.suitability ->>
'previous_investments' AS previous_investments,\n account.suitability ->> 'investment_experience'
AS investment_experience,\n account.suitability ->> 'investment_objectives'
AS investment_objectives,\n account.suitability -> 'other_previous_investments'
AS other_previous_investments,\n account.suitability ->> 'ownership_interest_primary'
AS ownership_interest_primary,\n account.suitability ->> 'more_than_one_account_operator'
AS more_than_one_account_operator,\n account.suitability ->> 'more_than_one_account_operator_relationship'
AS more_than_one_account_operator_relationship,\n account.suitability ->> 'more_than_one_account_operator_name'
AS more_than_one_account_operator_name,\n account.suitability ->> 'more_than_one_account_operator_phone'
AS more_than_one_account_operator_phone,\n account.suitability ->> 'account_opened_on_behalf'
AS account_opened_on_behalf,\n account.suitability ->> 'trustee_contact_person'
AS trustee_contact_person,\n account.suitability ->> 'trustee_contact_person'
AS trustee_contact_person,\n account.suitability ->> 'trustee_contact_person_name'
AS trustee_contact_person_name,\n account.suitability ->> 'trustee_contact_person_phone'
AS trustee_contact_person_phone,\n account.suitability ->> 'confirm_investment_single_offering'
AS confirm_investment_single_offering,\n account.suitability ->> 'more_than_25_percent_or_politically_exposed'
AS more_than_25_percent_or_politically_exposed,\n account.suitability ->> 'employment_status'
AS employment_status,\n account.suitability ->> 'politically_exposed' AS politically_exposed,\n
\ account.suitability ->> 'net_financial_assets' AS net_financial_assets,\n
\ account.suitability ->> 'using_borrowed_money' AS using_borrowed_money,\n
\ account.suitability ->> 'pre_tax_annual_income' AS pre_tax_annual_income,\n
\ account.suitability ->> 'insider_reporting_issuer' AS insider_reporting_issuer,\n
\ account.suitability ->> 'other_previous_investments' AS other_previous_investments\n
\ FROM account left join entity_profile on entity_profile.id = account.entity_id
left join user_profile pu on pu.id = account.primary_user_id left join user_profile
ju on ju.id = account.secondary_user_id left join kyc kyc_pu ON kyc_pu.user_id
= account.primary_user_id left join kyc kyc_ju ON kyc_ju.user_id = account.secondary_user_id\n
\ left join note note_pu ON note_pu.id = kyc_pu.note_id\n left join note note_ju
ON note_ju.id = kyc_ju.note_id"
actions:
- visible: false
name: create
- visible: false
name: edit
- visible: false
name: remove
tabs:
- visible: false
name: notes
- tab_type: query
preferences:
query_id: 5
name: audits
searchable_columns:
- id
- primary_user_email
- secondary_user_email
- entity_name
- joint_user_first_name
- joint_user_last_name
- primary_user_phone
- joint_user_email
- joint_user_phone
- primary_user_last_name
- primary_user_first_name
associations:
- name: transactions
display_name: Transactions
model_name: transaction
foreign_key: investor_id
primary_key: id
virtual: true
polymorphic: false
slug: transactions
- name: notes
display_name: Notes
model_name: note
foreign_key: account_id
primary_key: id
virtual: true
polymorphic: false
slug: notes
- name: account_users
display_name: Users
model_name: account_user
foreign_key: account_id
primary_key: id
virtual: true
polymorphic: false
slug: account_users
- name: referrals
display_name: Referrals
model_name: account
foreign_key: referrer_account_id
primary_key: id
virtual: true
polymorphic: false
slug: referrals
scopes:
- name: invested
display_name: Invested
scope_type: filter
preferences:
filter:
- contributions:
gt: 0
- name: pending_kyc_not_invested
display_name: Pending KYC Not Invested
scope_type: filter
preferences:
filter:
- pending_kyc_not_invested:
eq: true
- name: referral_agents
display_name: Referral Agents
scope_type: filter
preferences:
filter:
- account_type:
eq: individual_referral_agent
- OR
- account_type:
eq: entity_referral_agent
- name: issuers
display_name: Issuers
scope_type: filter
preferences:
filter:
- account_type:
eq: issuer
- name: kycd_not_invested_
display_name: 'KYCd Not Invested '
scope_type: filter
preferences:
filter:
- kycd_not_invested:
eq: true
columns:
- name: referrals
display_name: Referrals
column_type: integer
access_type: read_only
reference:
name: referrals
display_name: Referrals
reference_type: belongs_to
foreign_key: referrals
primary_key: id
options: {}
polymorphic: false
virtual: true
virtual: false
format: {}
validators: []
description: ''
updated_at: 2025-05-28 16:27:03.674577000 +00:00
- name: account_user
preferences:
custom_sql: "SELECT x.*, (SELECT COUNT(a.*) FROM account a WHERE a.referrer_account_user_id
= x.id) as referred FROM (select\nDISTINCT ON (account.id, account_user.id)\naccount_user.id,\naccount.type
as account_type,\naccount.id as account_id,\naccount.account_number as account_number,
\naccount.risk_rating as account_risk_rating,\nentity_profile.name as entity_name,\naccount_user.type
as user_type,\nuser_profile.first_name, \nuser_profile.last_name, \nuser_profile.email,\naccount_user.is_director
as is_director,\naccount_user.shareholder_percentage_ownership as shareholder_percentage_ownership,\nkyc.provider
AS kyc_provider,\nkyc.status as kyc_provider_status,\nEXISTS (\n SELECT 1\n
\ FROM jsonb_array_elements(kyc.veriff_report -> 'pepAndSanctions' -> 'hits')
AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'pep' -> 0 IS NOT NULL\n)
OR (kyc.onfido_report -> 'reports' -> 1 -> 'breakdown' -> 'politically_exposed_person'
->> 'result' != 'clear') AS kyc_pep_hit,\nEXISTS (\n SELECT 1\n FROM jsonb_array_elements(kyc.veriff_report
-> 'pepAndSanctions' -> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch'
-> 'sanctions' -> 0 IS NOT NULL\n) OR (kyc.onfido_report -> 'reports' -> 1 ->
'breakdown' -> 'sanction' ->> 'result' != 'clear') AS kyc_sanctions_hit,\n EXISTS
(\n SELECT 1 \n FROM jsonb_array_elements(kyc.veriff_report -> 'pepAndSanctions'
-> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'warnings' ->
0 IS NOT NULL\n) OR (kyc.onfido_report -> 'reports' -> 1 -> 'breakdown' -> 'legal_and_regulatory_warnings'
->> 'result' != 'clear') AS kyc_warnings_hit,\nEXISTS (\n SELECT 1\n FROM
jsonb_array_elements(kyc.veriff_report -> 'pepAndSanctions' -> 'hits') AS hits\n
\ WHERE hits -> 'listingsRelatedToMatch' -> 'fitnessProbity' -> 0 IS NOT NULL\n)
AS kyc_fitness_probity_hit,\nkyc.kyc_hits_review_status,\nkyc.kyc_questions_review_status,\nkyc.document_type
AS kyc_document_type,\nkyc.document_number AS kyc_document_number,\nkyc.document_country
AS kyc_document_country,\nkyc.document_valid_from AS kyc_document_issuing_date,\nkyc.document_valid_to
AS kyc_document_expiry_date\nfrom account_user \ninner join account on account.id
= account_user.account_id \ninner join user_profile on user_profile.id = account_user.user_id
\nleft join entity_profile on entity_profile.id = account.entity_id \ninner
join kyc on kyc.user_id = user_profile.id \nleft join transaction on transaction.investor_id
= account.id\norder by\naccount.id,\naccount_user.id) as x ORDER BY\nkyc_pep_hit
DESC NULLS LAST,\nkyc_sanctions_hit DESC NULLS LAST,\nkyc_warnings_hit DESC
NULLS LAST,\nkyc_fitness_probity_hit DESC NULLS LAST,\nCASE WHEN kyc_provider_status
= 'pending' THEN 1 ELSE 2 END DESC NULLS LAST"
associations:
- name: accounts
display_name: Accounts
model_name: account
foreign_key: id
primary_key: account_id
virtual: true
polymorphic: false
slug: accounts
- name: transactions
display_name: Transactions
model_name: transaction
foreign_key: investor_id
primary_key: account_id
virtual: true
polymorphic: false
slug: transactions
- name: referrals
display_name: Referred
model_name: account
foreign_key: referrer_account_user_id
primary_key: id
virtual: true
polymorphic: false
slug: referrals
scopes:
- name: investor
display_name: Investor
scope_type: filter
preferences:
filter:
- account_type:
eq: individual_investor
- OR
- account_type:
eq: entity_investor
- OR
- account_type:
eq: joint_investor
sort:
key: referred
order: asc
- name: referral_agent
display_name: Referral Agent
scope_type: filter
preferences:
filter:
- account_type:
eq: entity_referral_agent
- OR
- account_type:
eq: individual_referral_agent
sort:
key: referred
order: desc
- name: admin
display_name: Admin
scope_type: filter
preferences:
filter:
- account_type:
eq: admin
- name: issuer
display_name: Issuer
scope_type: filter
preferences:
filter:
- account_type:
eq: issuer
sort:
key: referred
order: asc
updated_at: 2024-03-29 14:35:46.980799000 +00:00
- name: account_wallet
preferences:
columns:
- column_type: reference
reference:
name: account
display_name: Account
model_name: account
reference_type: belongs_to
foreign_key: account_id
primary_key: id
options: {}
polymorphic: false
virtual: true
name: account_id
updated_at: 2024-03-15 19:05:08.996534000 +00:00
- name: active_storage/attachment
preferences: {}
updated_at: 2024-02-27 22:42:12.103733000 +00:00
- name: audit
preferences:
associations:
- name: account_user
display_name: Account User
model_name: account_user
foreign_key: user_id
primary_key: actor_id
virtual: true
polymorphic: false
slug: account_user
columns:
- name: actor_name
display_name: Actor Name
column_type: string
access_type: read_write
virtual: true
format: {}
validators: []
custom_sql: SELECT "audit"."created_at", "audit"."updated_at", "audit"."deleted_at",
"audit"."id", "audit"."actor_id", "user_profile"."first_name" as "actor_first_name",
"user_profile"."last_name" as "actor_last_name", "audit"."role_assumed_by_id",
"audit"."actor_ip", "audit"."resource_name", "audit"."resource_id", "audit"."action",
"audit"."description", "audit"."old_data", "audit"."new_data", "audit"."request",
"audit"."response", "audit"."migrate_from", "audit"."migration_data" FROM "audit"
left join "account_user" on "account_user"."id" = "actor_id" left join "user_profile"
on "user_profile"."id" = "account_user"."user_id" order by created_at DESC
actions:
- visible: false
name: create
- visible: false
name: edit
- visible: false
name: remove
updated_at: 2024-03-26 17:37:27.345769000 +00:00
- name: bank_account
preferences:
custom_sql: "SELECT bank_account.id, account.id as account_id, account.type as
account_type, \"bank_account\".*, en.name as entity_name, pu.first_name, pu.last_name,
pu.email, pu.phone, ju.first_name as joint_user_first_name, pu.last_name as
joint_user_last_name, ju.email as joint_user_email, ju.phone as joint_user_phone\nFROM
\"bank_account\" \nleft join account on account.id = bank_account.account_id\nleft
join user_profile pu on pu.id = account.primary_user_id\nleft join user_profile
ju on ju.id = account.secondary_user_id\nleft join entity_profile en on en.id
= account.entity_id"
columns:
- access_type: hidden
name: account_id
tabs:
- visible: false
name: audits
- visible: false
name: notes
associations:
- name: transactions
display_name: Transactions
model_name: transaction
foreign_key: investor_id
primary_key: account_id
virtual: true
polymorphic: false
slug: transactions
- name: account
display_name: Account
model_name: account
foreign_key: id
primary_key: account_id
virtual: true
polymorphic: false
slug: account
updated_at: 2024-03-28 14:24:46.329167000 +00:00
- name: blockchain_contract
preferences:
visible: false
updated_at: 2024-02-27 22:43:07.639323000 +00:00
- name: blockchain_network
preferences:
visible: false
updated_at: 2024-02-27 22:43:08.804563000 +00:00
- name: country
preferences:
tabs:
- tab_type: query
preferences:
query_id: 17
name: details
columns:
- name: customer_id
display_name: Customer
column_type: reference
access_type: read_only
reference:
name: customer
display_name: Customer
model_name: customer
reference_type: belongs_to
foreign_key: customer_id
primary_key: id
options: {}
polymorphic: false
virtual: true
virtual: false
format: {}
associations:
- name: customers
display_name: Customers
model_name: customer
icon: user-check
foreign_key: country_code
primary_key: code
virtual: true
polymorphic: false
slug: customers
- name: orders
display_name: Orders
model_name: order
foreign_key: customer_id
primary_key: id
options:
through: customers
source: orders
virtual: true
polymorphic: false
slug: orders
custom_sql: |-
SELECT co.*, count(cs.id) as customers_count FROM countries as co
JOIN customers as cs ON cs.country_code = co.code
GROUP BY co.id
updated_at: 2021-12-04 10:25:38.021847000 +00:00
- name: customer
preferences:
columns:
- display_name: Country
name: country_code
- display_name: Type
name: kind
- name: sales_per_year
display_name: Sales per year
column_type: chart
access_type: read_only
default_value: ''
virtual: true
format: {}
- name: monthly_sales_diff
display_name: Monthly sales diff
column_type: change
access_type: read_only
default_value: ''
virtual: true
format: {}
- column_type: percentage
default_value: ''
name: reputation
- name: lifetime_value
display_name: Lifetime value
column_type: currency
access_type: read_only
virtual: false
format:
currency: USD
currency_base: cents
scopes:
- display_name: VIP
name: vip
tabs:
- name: sales
display_name: Sales
tab_type: dashboard
preferences:
dashboard_id: 2
custom_sql: |-
SELECT cs.*, sum(li.quantity * li.unit_price) as lifetime_value FROM customers as cs
LEFT JOIN orders as od ON od.customer_id = cs.id
LEFT JOIN line_items as li ON od.id = li.order_id
GROUP BY cs.id
updated_at: 2021-07-15 17:23:20.368063000 +00:00
- name: distribution
preferences:
visible: false
updated_at: 2024-02-27 22:43:12.932862000 +00:00
- name: distribution_checkpoint
preferences:
columns:
- access_type: hidden
name: dps
- access_type: hidden
name: resolution_id
- access_type: hidden
name: migrate_from
- access_type: hidden
name: migration_data
- access_type: hidden
name: shares
visible: false
updated_at: 2024-03-22 07:45:02.498994000 +00:00
- name: distribution_resolution
preferences:
visible: false
updated_at: 2024-02-27 22:43:11.782576000 +00:00
- name: document_template
preferences:
visible: false
updated_at: 2024-02-27 23:13:06.810289000 +00:00
- name: kyc
preferences:
actions:
- visible: false
name: create
- visible: false
name: edit
- visible: false
name: remove
tabs:
- visible: false
name: audits
- visible: false
name: notes
custom_sql: "SELECT\nkyc.id,\nuser_profile.first_name as first_name,\nuser_profile.last_name
as last_name,\nuser_profile.email as email,\nuser_profile.phone as phone,\nuser_profile.accreditation_status
as accreditation_status,\nuser_profile.accreditation_criteria as accreditation_qualification,\n\tkyc.provider
AS kyc_provider,\n\tkyc.status AS kyc_provider_status,\nkyc.kyc_date as kyc_date,\n\tnote.content
as note,\n\tkyc.status AS kyc_questions_review_status,\nkyc.kyc_hits_review_status
AS kyc_hits_review_status,\n\tkyc.document_type AS document_type,\n\tkyc.document_number
AS document_number,\n\tkyc.document_valid_from AS document_valid_from,\n\tkyc.document_valid_to
AS document_valid_to,\n\tkyc.document_country AS document_country,\nEXISTS (\n
\ SELECT 1\n FROM jsonb_array_elements(kyc.veriff_report -> 'pepAndSanctions'
-> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'pep' -> 0 IS
NOT NULL\n) OR (kyc.onfido_report -> 'reports' -> 1 -> 'breakdown' -> 'politically_exposed_person'
->> 'result' != 'clear') AS kyc_pep_hit,\nEXISTS (\n SELECT 1\n FROM jsonb_array_elements(kyc.veriff_report
-> 'pepAndSanctions' -> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch'
-> 'sanctions' -> 0 IS NOT NULL\n) OR (kyc.onfido_report -> 'reports' -> 1 ->
'breakdown' -> 'sanction' ->> 'result' != 'clear') AS kyc_sanctions_hit,\n EXISTS
(\n SELECT 1 \n FROM jsonb_array_elements(kyc.veriff_report -> 'pepAndSanctions'
-> 'hits') AS hits\n WHERE hits -> 'listingsRelatedToMatch' -> 'warnings' ->
0 IS NOT NULL\n) OR (kyc.onfido_report -> 'reports' -> 1 -> 'breakdown' -> 'legal_and_regulatory_warnings'
->> 'result' != 'clear') AS kyc_warnings_hit,\nEXISTS (\n SELECT 1\n FROM
jsonb_array_elements(kyc.veriff_report -> 'pepAndSanctions' -> 'hits') AS hits\n
\ WHERE hits -> 'listingsRelatedToMatch' -> 'fitnessProbity' -> 0 IS NOT NULL\n)
AS kyc_fitness_probity_hit\n\nFROM \n\nkyc\n\nleft join user_profile ON kyc.user_id
= user_profile.id\nleft join note ON note.id = kyc.note_id"
display_name: KYC
columns:
- name: accounts
display_name: Accounts
column_type: reference
access_type: read_only
reference:
name: accounts
display_name: Accounts
model_name: account
reference_type: belongs_to
foreign_key: accounts
primary_key: account_number
options: {}
polymorphic: false
virtual: true
virtual: false
format: {}
validators: []
description: ''
scopes:
- name: veriff
display_name: Veriff
scope_type: filter
preferences:
filter:
- kyc_provider:
eq: veriff
- name: manual
display_name: Manual
scope_type: filter
preferences:
filter:
- kyc_provider:
eq: manual
- name: onfido
display_name: Onfido
scope_type: filter
preferences:
filter:
- kyc_provider:
eq: onfido
updated_at: 2025-07-02 16:16:17.040697000 +00:00
- name: line_item
preferences:
columns:
- column_type: currency
default_value: ''
format:
currency: USD
currency_base: cents
name: unit_price
visible: false
updated_at: 2021-12-04 10:25:38.023578000 +00:00
- name: migration
preferences:
visible: false
updated_at: 2024-02-27 23:10:25.380912000 +00:00
- name: note
preferences:
custom_sql: "SELECT \n coalesce(ie.name, e.name) as entity_name, \n coalesce(user_profile.first_name,
ipu.first_name, pu.first_name) as first_name, \n coalesce(user_profile.last_name,
ipu.last_name, pu.last_name) as last_name, \n x.* \nFROM (\n (\n SELECT
\n \"note\".\"id\",\n note.type,\n \"note\".\"content\"
as \"note\",\n note.transaction_id,\n note.account_id,\n
\ note.user_id as \"user_profile_id\",\n \"note\".\"created_at\"::date
,\n \"note\".\"updated_at\"::date\n FROM \"note\"\n )\n
\ UNION\n (\n SELECT \n 'dealing-rep-suitability-note-'
|| \"transaction\".\"id\", \n 'suitability' as \"type\", \n \"transaction\".\"suitability_notes\"->>'dealing_rep_note'
as \"note\", \n transaction.id as transaction_id,\n transaction.investor_id
as account_id,\n null as \"user_profile_id\",\n coalesce((\"transaction\".\"suitability_notes\"->>'dealing_rep_note_created_at')::date,\n
\ \"transaction\".\"created_at\"::date) as \"created_at\",\n coalesce((\"transaction\".\"suitability_notes\"->>'dealing_rep_note_updated_at')::date,\n
\ \"transaction\".\"updated_at\"::date) as \"updated_at\"\n FROM
\"transaction\"\n WHERE\n \"transaction\".\"type\" = 'contribution'
and \n \"transaction\".\"suitability_notes\"->'dealing_rep_note'
is not null and \n \"transaction\".\"suitability_notes\"->>'dealing_rep_note'
!= ''\n ) \n UNION\n (\n SELECT \n 'cco-suitability-note-'
|| \"transaction\".\"id\", \n 'suitability' as \"type\", \n \"transaction\".\"suitability_notes\"->>'cco_note'
as \"note\", \n transaction.id as transaction_id, \n transaction.investor_id
as account_id, \n null as \"user_profile_id\", \n coalesce((\"transaction\".\"suitability_notes\"->>'cco_note_created_at')::date,
\n \"transaction\".\"created_at\"::date) as \"created_at\", \n coalesce((\"transaction\".\"suitability_notes\"->>'cco_note_updated_at')::date,
\n \"transaction\".\"updated_at\"::date) as \"updated_at\"\n FROM
\"transaction\"\n WHERE \n \"transaction\".\"type\" = 'contribution'
and \n \"transaction\".\"suitability_notes\"->'cco_note' is not null
and \n \"transaction\".\"suitability_notes\"->>'cco_note' != ''\n
\ )\n) as x\nLEFT JOIN account on account.id = x.account_id\nLEFT JOIN entity_profile
e on e.id = account.entity_id\nLEFT JOIN user_profile pu on pu.id = account.primary_user_id\nLEFT
JOIN transaction on transaction.id = x.transaction_id\nLEFT JOIN account i on
i.id = transaction.investor_id\nLEFT JOIN entity_profile ie on ie.id = i.entity_id\nLEFT
JOIN user_profile ipu on ipu.id = i.primary_user_id\nLEFT JOIN user_profile
on user_profile.id = x.user_profile_id\nORDER BY created_at DESC"
columns:
- name: user_profile_id
display_name: User
column_type: string
access_type: read_only
virtual: false
format: {}
validators: []
description: ''
tabs:
- visible: false
name: audits
- visible: false
name: notes
actions:
- visible: false
name: create
- visible: false
name: edit
- visible: false
name: remove
associations:
- name: account
display_name: Accounts
model_name: account
foreign_key: id
primary_key: account_id
virtual: true
polymorphic: false
slug: account
- name: account_users
display_name: Account Users
model_name: account_user
foreign_key: account_id
primary_key: account_id
virtual: true
polymorphic: false
slug: account_users
- name: user_profile
display_name: User Profile
model_name: user_profile
foreign_key: id
primary_key: user_profile_id
virtual: true
polymorphic: false
slug: user_profile
scopes:
- name: kyc
display_name: KYC
scope_type: filter
preferences:
filter:
- type:
eq: kyc
- name: suitability
display_name: Suitability
scope_type: filter
preferences:
filter:
- type:
eq: suitability
- name: other
display_name: Other
scope_type: filter
preferences:
filter:
- type:
neq: kyc
- type:
neq: suitability
updated_at: 2024-06-03 18:18:23.040789000 +00:00
- name: offer
preferences:
preferences:
display_as: kanban
kanban_column: status
kanban_card_columns:
- id
- symbol
- name
- offer_size
- minimum_investment
- maximum_investment
- minimum_subsequent_investments
actions:
- visible: false
name: create
- visible: false
name: edit
- visible: false
name: remove
updated_at: 2024-03-25 18:53:22.840837000 +00:00
- name: offer_dealing_rep
preferences:
actions:
- visible: false
name: create
- visible: false
name: edit
- visible: false
name: remove
custom_sql: "SELECT \n\"offer_dealing_rep\".id,\nuser_profile.first_name,\nuser_profile.last_name,\nuser_profile.email,\noffer.symbol,\noffer.name,\noffer_dealing_rep.condition
IS NULL as global_condition,\ncoalesce(offer_dealing_rep.condition->'and'->0->'in'->>1,
account_user.dealing_rep_condition->'and'->0->'in'->>1) as provice_condition\nFROM
offer_dealing_rep\nLEFT JOIN offer ON offer.symbol = offer_dealing_rep.offer_symbol\nLEFT
JOIN account_user ON account_user.id = offer_dealing_rep.account_user_id\nLEFT
JOIN user_profile ON user_profile.id = account_user.user_id"
updated_at: 2024-03-28 13:56:44.829445000 +00:00
- name: offer_document
preferences:
visible: false
updated_at: 2024-03-20 18:54:00.101329000 +00:00
- name: offer_engagement
preferences:
custom_sql: "SELECT\ne.id,\ne.offer_symbol,\noffer.name as offer_name,\naccount.type
as account_type,\ne.account_id as account_id,\naccount.account_number,\nen.name
as entity_name,\npu.first_name,\npu.last_name,\npu.email,\nju.first_name as
joint_user_first_name,\nju.last_name as joint_user_last_name,\nju.email as joint_user_email,\nCASE
\n WHEN EXISTS (\n SELECT 1 FROM transaction WHERE transaction.investor_id
= e.account_id\n ) THEN 'invested'\n WHEN EXISTS (\n SELECT 1 \n FROM
jsonb_each_text(e.time_spent) as each_document\n WHERE each_document.key
LIKE 'Document%'\n ) THEN 'viewed_documents'\n ELSE 'viewed' \nEND as state,\ne.viewed_at,\n
ARRAY(\n SELECT key\n FROM jsonb_each_text(e.time_spent)\n WHERE key
LIKE 'Document%'\n ) AS documents_viewed\nFROM \n\"offer_engagement\" e \nleft
join offer on offer.symbol = e.offer_symbol\nleft join account on account.id
= e.account_id\nleft join user_profile pu on pu.id = account.primary_user_id\nleft
join user_profile ju on ju.id = account.secondary_user_id\nleft join entity_profile
en on en.id = account.entity_id\nWHERE\naccount.type not in ('admin', 'issuer')"
searchable_columns:
- id
- offer_symbol
- account_number
- entity_name
- first_name
- last_name
- joint_first_name
- joint_last_name
scopes:
- name: viewed
display_name: Viewed
scope_type: filter
preferences:
filter:
- state:
eq: viewed
- name: viewed_documents
display_name: Viewed Documents
scope_type: filter
preferences:
filter:
- state:
eq: viewed_documents
- name: invested
display_name: Invested
scope_type: filter
preferences:
filter:
- state:
eq: invested
tabs:
- visible: false
name: audits
- visible: false
name: notes
associations:
- name: account
display_name: Account
model_name: account
foreign_key: id
primary_key: account_id
virtual: true
polymorphic: false
slug: account
- name: transactions
display_name: Transactions
model_name: transaction
foreign_key: investor_id
primary_key: account_id
virtual: true
polymorphic: false
slug: transactions
actions:
- visible: false
name: edit
- visible: false
name: create
- visible: false
name: remove
columns:
- display_name: Account id
name: account_id
updated_at: 2024-06-21 14:11:29.092461000 +00:00
- name: offer_group_tag
preferences:
visible: false
updated_at: 2024-03-20 18:50:26.072798000 +00:00
- name: offer_group_tags_offer_group_tag
preferences:
visible: false
updated_at: 2024-03-20 18:50:24.992571000 +00:00
- name: offer_referrer
preferences:
custom_sql: SELECT "offer_referrer".id, offer.symbol as offer_symbol, offer.name
as offer_name, entity_profile.name as entity_name, user_profile.first_name,
user_profile.last_name, offer_referrer.commission FROM "offer_referrer" LEFT
JOIN account ON account.id = offer_referrer.referral_agent_id LEFT JOIN user_profile
ON user_profile.id = account.primary_user_id LEFT JOIN entity_profile ON entity_profile.id
= account.entity_id LEFT JOIN offer ON offer.symbol = offer_referrer.offer_symbol
columns:
- display_name: Referral agent (account id)
name: referral_agent_id
updated_at: 2024-06-19 18:37:42.266788000 +00:00
- name: offer_tag
preferences:
visible: false
updated_at: 2024-03-20 18:50:24.295969000 +00:00
- name: offer_tags_offer_tag
preferences:
visible: false
updated_at: 2024-03-20 18:50:23.187858000 +00:00
- name: offer_tags_tag
preferences:
visible: false
updated_at: 2024-03-20 18:50:22.603002000 +00:00
- name: offer_update
preferences:
columns:
- column_type: reference
reference:
name: nav
display_name: Nav
model_name: offer_price
reference_type: belongs_to
foreign_key: nav_id
primary_key: id
options: {}
polymorphic: false
virtual: true
name: nav_id
- column_type: reference
reference:
name: document
display_name: Document
model_name: document
reference_type: belongs_to
foreign_key: document_id
primary_key: id
options: {}
polymorphic: false
virtual: true
name: document_id
updated_at: 2024-03-20 18:50:48.580890000 +00:00
- name: order
preferences:
actions:
- name: mark_as_shipped
display_name: Mark as Shipped
action_type: method
preferences:
method_name: ship!
- name: cancel
display_name: Cancel
action_type: form
preferences:
form_id: 1
- action_type: form
preferences:
form_id: 2
name: create
columns:
- name: total_price
display_name: Total price
column_type: currency
access_type: read_only
virtual: true
format:
currency: USD
currency_base: cents
- name: map_link
display_name: Map link
column_type: link
access_type: read_write
default_value: ''
virtual: true
format:
link_text: "\U0001F4CD Map"
updated_at: 2021-12-04 10:25:38.026092000 +00:00
- name: order_note
preferences:
display_name: Notes
updated_at: 2021-12-04 10:25:38.027365000 +00:00
- name: platform_custody_wallet
preferences:
visible: false
updated_at: 2024-02-27 23:11:53.509985000 +00:00
- name: product
preferences:
columns:
- column_type: currency
default_value: ''
format:
currency: USD
currency_base: cents
name: price
- access_type: hidden
name: slug
- column_type: richtext
default_value: ''
name: description
associations:
- visible: false
name: line_items
updated_at: 2021-12-04 10:25:38.028556000 +00:00
- name: redemption
preferences:
visible: false
updated_at: 2024-02-27 22:44:25.134531000 +00:00
- name: redemption_transaction
preferences:
visible: false