@happyvertical/smrt-support 0.49.3 → 0.49.4

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.
@@ -2,7 +2,7 @@
2
2
  "version": "1.0.0",
3
3
  "timestamp": 0,
4
4
  "packageName": "@happyvertical/smrt-support",
5
- "packageVersion": "0.49.3",
5
+ "packageVersion": "0.49.4",
6
6
  "objects": {
7
7
  "@happyvertical/smrt-support:ServiceTimeEntry": {
8
8
  "name": "servicetimeentry",
@@ -454,7 +454,8 @@
454
454
  "slug",
455
455
  "context"
456
456
  ],
457
- "unique": true
457
+ "unique": true,
458
+ "nullsNotDistinct": true
458
459
  },
459
460
  {
460
461
  "name": "service_time_entries_tenant_id_created_at_idx",
@@ -564,7 +565,7 @@
564
565
  "collectionExportName": "ServiceTimeEntryCollectionCollection",
565
566
  "schema": {
566
567
  "tableName": "service_time_entries",
567
- "ddl": "CREATE TABLE IF NOT EXISTS \"service_time_entries\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
568
+ "ddl": "CREATE TABLE IF NOT EXISTS \"service_time_entries\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"case_id\" UUID,\n \"work_ref_type\" TEXT,\n \"work_ref_id\" TEXT,\n \"specialist_id\" UUID,\n \"participant_kind\" TEXT,\n \"participant_profile_id\" UUID,\n \"agent_ref\" TEXT,\n \"source\" TEXT,\n \"description\" TEXT,\n \"started_at\" TIMESTAMP,\n \"ended_at\" TIMESTAMP,\n \"duration_seconds\" INTEGER DEFAULT 0,\n \"evidence\" TEXT,\n \"status\" TEXT,\n \"submitted_at\" TIMESTAMP,\n \"submitted_by_profile_id\" UUID,\n \"approved_at\" TIMESTAMP,\n \"approved_by_profile_id\" UUID,\n \"approval_path\" TEXT,\n \"rejected_at\" TIMESTAMP,\n \"rejected_by_profile_id\" UUID,\n \"rejection_reason\" TEXT,\n \"correction_of_id\" UUID,\n \"metadata\" TEXT\n);",
568
569
  "columns": {
569
570
  "id": {
570
571
  "type": "UUID",
@@ -590,25 +591,222 @@
590
591
  "type": "TIMESTAMP",
591
592
  "notNull": true,
592
593
  "default": "current_timestamp"
594
+ },
595
+ "tenant_id": {
596
+ "type": "UUID",
597
+ "referenceKind": "tenantId",
598
+ "notNull": false,
599
+ "unique": false
600
+ },
601
+ "case_id": {
602
+ "type": "UUID",
603
+ "referenceKind": "foreignKey",
604
+ "notNull": false,
605
+ "unique": false,
606
+ "foreignKey": {
607
+ "table": "support_cases",
608
+ "column": "id",
609
+ "onDelete": "NO ACTION",
610
+ "onUpdate": "CASCADE"
611
+ }
612
+ },
613
+ "work_ref_type": {
614
+ "type": "TEXT",
615
+ "notNull": false,
616
+ "unique": false
617
+ },
618
+ "work_ref_id": {
619
+ "type": "TEXT",
620
+ "notNull": false,
621
+ "unique": false
622
+ },
623
+ "specialist_id": {
624
+ "type": "UUID",
625
+ "referenceKind": "foreignKey",
626
+ "notNull": false,
627
+ "unique": false,
628
+ "foreignKey": {
629
+ "table": "support_specialists",
630
+ "column": "id",
631
+ "onDelete": "NO ACTION",
632
+ "onUpdate": "CASCADE"
633
+ }
634
+ },
635
+ "participant_kind": {
636
+ "type": "TEXT",
637
+ "notNull": false,
638
+ "unique": false
639
+ },
640
+ "participant_profile_id": {
641
+ "type": "UUID",
642
+ "referenceKind": "crossPackageRef",
643
+ "notNull": false,
644
+ "unique": false
645
+ },
646
+ "agent_ref": {
647
+ "type": "TEXT",
648
+ "notNull": false,
649
+ "unique": false
650
+ },
651
+ "source": {
652
+ "type": "TEXT",
653
+ "notNull": false,
654
+ "unique": false
655
+ },
656
+ "description": {
657
+ "type": "TEXT",
658
+ "notNull": false,
659
+ "unique": false
660
+ },
661
+ "started_at": {
662
+ "type": "TIMESTAMP",
663
+ "notNull": false,
664
+ "unique": false
665
+ },
666
+ "ended_at": {
667
+ "type": "TIMESTAMP",
668
+ "notNull": false,
669
+ "unique": false
670
+ },
671
+ "duration_seconds": {
672
+ "type": "INTEGER",
673
+ "notNull": false,
674
+ "unique": false,
675
+ "default": 0
676
+ },
677
+ "evidence": {
678
+ "type": "TEXT",
679
+ "notNull": false,
680
+ "unique": false
681
+ },
682
+ "status": {
683
+ "type": "TEXT",
684
+ "notNull": false,
685
+ "unique": false
686
+ },
687
+ "submitted_at": {
688
+ "type": "TIMESTAMP",
689
+ "notNull": false,
690
+ "unique": false
691
+ },
692
+ "submitted_by_profile_id": {
693
+ "type": "UUID",
694
+ "referenceKind": "crossPackageRef",
695
+ "notNull": false,
696
+ "unique": false
697
+ },
698
+ "approved_at": {
699
+ "type": "TIMESTAMP",
700
+ "notNull": false,
701
+ "unique": false
702
+ },
703
+ "approved_by_profile_id": {
704
+ "type": "UUID",
705
+ "referenceKind": "crossPackageRef",
706
+ "notNull": false,
707
+ "unique": false
708
+ },
709
+ "approval_path": {
710
+ "type": "TEXT",
711
+ "notNull": false,
712
+ "unique": false
713
+ },
714
+ "rejected_at": {
715
+ "type": "TIMESTAMP",
716
+ "notNull": false,
717
+ "unique": false
718
+ },
719
+ "rejected_by_profile_id": {
720
+ "type": "UUID",
721
+ "referenceKind": "crossPackageRef",
722
+ "notNull": false,
723
+ "unique": false
724
+ },
725
+ "rejection_reason": {
726
+ "type": "TEXT",
727
+ "notNull": false,
728
+ "unique": false
729
+ },
730
+ "correction_of_id": {
731
+ "type": "UUID",
732
+ "referenceKind": "foreignKey",
733
+ "notNull": false,
734
+ "unique": false,
735
+ "foreignKey": {
736
+ "table": "service_time_entries",
737
+ "column": "id",
738
+ "onDelete": "NO ACTION",
739
+ "onUpdate": "CASCADE"
740
+ }
741
+ },
742
+ "metadata": {
743
+ "type": "TEXT",
744
+ "notNull": false,
745
+ "unique": false
593
746
  }
594
747
  },
595
748
  "indexes": [
596
749
  {
597
750
  "name": "service_time_entries_slug_context_idx",
598
751
  "columns": [
752
+ "tenant_id",
599
753
  "slug",
600
754
  "context"
601
755
  ],
602
- "unique": true
756
+ "unique": true,
757
+ "nullsNotDistinct": true
603
758
  },
604
759
  {
605
- "name": "service_time_entries_created_at_idx",
760
+ "name": "service_time_entries_tenant_id_created_at_idx",
606
761
  "columns": [
762
+ "tenant_id",
607
763
  "created_at"
608
764
  ]
765
+ },
766
+ {
767
+ "name": "service_time_entries_case_id_idx",
768
+ "columns": [
769
+ "case_id"
770
+ ]
771
+ },
772
+ {
773
+ "name": "service_time_entries_specialist_id_idx",
774
+ "columns": [
775
+ "specialist_id"
776
+ ]
777
+ },
778
+ {
779
+ "name": "service_time_entries_participant_profile_id_idx",
780
+ "columns": [
781
+ "participant_profile_id"
782
+ ]
783
+ },
784
+ {
785
+ "name": "service_time_entries_submitted_by_profile_id_idx",
786
+ "columns": [
787
+ "submitted_by_profile_id"
788
+ ]
789
+ },
790
+ {
791
+ "name": "service_time_entries_approved_by_profile_id_idx",
792
+ "columns": [
793
+ "approved_by_profile_id"
794
+ ]
795
+ },
796
+ {
797
+ "name": "service_time_entries_rejected_by_profile_id_idx",
798
+ "columns": [
799
+ "rejected_by_profile_id"
800
+ ]
801
+ },
802
+ {
803
+ "name": "service_time_entries_correction_of_id_idx",
804
+ "columns": [
805
+ "correction_of_id"
806
+ ]
609
807
  }
610
808
  ],
611
- "version": "d9c34ac0"
809
+ "version": "33f1042d"
612
810
  }
613
811
  },
614
812
  "@happyvertical/smrt-support:SupportAiRun": {
@@ -963,7 +1161,8 @@
963
1161
  "slug",
964
1162
  "context"
965
1163
  ],
966
- "unique": true
1164
+ "unique": true,
1165
+ "nullsNotDistinct": true
967
1166
  },
968
1167
  {
969
1168
  "name": "support_ai_runs_tenant_id_created_at_idx",
@@ -1027,7 +1226,7 @@
1027
1226
  "collectionExportName": "SupportAiRunCollectionCollection",
1028
1227
  "schema": {
1029
1228
  "tableName": "support_ai_runs",
1030
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_ai_runs\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1229
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_ai_runs\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"case_id\" UUID NOT NULL,\n \"interaction_id\" UUID,\n \"phase\" TEXT,\n \"outcome\" TEXT,\n \"confidence\" REAL,\n \"classification\" TEXT,\n \"response_interaction_id\" UUID,\n \"knowledge_refs\" TEXT,\n \"tool_calls\" TEXT,\n \"error\" TEXT,\n \"correlation_id\" TEXT,\n \"model\" TEXT,\n \"started_at\" TIMESTAMP,\n \"completed_at\" TIMESTAMP,\n \"metadata\" TEXT\n);",
1031
1230
  "columns": {
1032
1231
  "id": {
1033
1232
  "type": "UUID",
@@ -1053,62 +1252,185 @@
1053
1252
  "type": "TIMESTAMP",
1054
1253
  "notNull": true,
1055
1254
  "default": "current_timestamp"
1056
- }
1057
- },
1058
- "indexes": [
1059
- {
1060
- "name": "support_ai_runs_slug_context_idx",
1061
- "columns": [
1062
- "slug",
1063
- "context"
1064
- ],
1065
- "unique": true
1066
1255
  },
1067
- {
1068
- "name": "support_ai_runs_created_at_idx",
1069
- "columns": [
1070
- "created_at"
1071
- ]
1072
- }
1073
- ],
1074
- "version": "87728103"
1075
- }
1076
- },
1077
- "@happyvertical/smrt-support:SupportCaseEvent": {
1078
- "name": "supportcaseevent",
1079
- "className": "SupportCaseEvent",
1080
- "qualifiedName": "@happyvertical/smrt-support:SupportCaseEvent",
1081
- "collection": "supportcaseevents",
1082
- "filePath": "/home/runner/work/smrt/smrt/packages/support/src/models/support-case-event.ts",
1083
- "packageName": "@happyvertical/smrt-support",
1084
- "fields": {
1085
- "tenantId": {
1086
- "type": "text",
1087
- "required": false,
1088
- "_meta": {
1089
- "sqlType": "UUID",
1090
- "nullable": true,
1091
- "__tenancy": {
1092
- "isTenantIdField": true,
1093
- "autoFilter": true,
1094
- "required": false,
1095
- "autoPopulate": true,
1096
- "nullable": true,
1097
- "mode": "optional",
1098
- "field": "tenantId",
1099
- "allowSuperAdminBypass": false
1100
- }
1101
- }
1102
- },
1103
- "caseId": {
1104
- "type": "foreignKey",
1105
- "required": true,
1106
- "related": "SupportCase",
1107
- "_meta": {
1108
- "required": true
1109
- }
1110
- },
1111
- "eventType": {
1256
+ "tenant_id": {
1257
+ "type": "UUID",
1258
+ "referenceKind": "tenantId",
1259
+ "notNull": false,
1260
+ "unique": false
1261
+ },
1262
+ "case_id": {
1263
+ "type": "UUID",
1264
+ "referenceKind": "foreignKey",
1265
+ "notNull": true,
1266
+ "unique": false,
1267
+ "foreignKey": {
1268
+ "table": "support_cases",
1269
+ "column": "id",
1270
+ "onDelete": "NO ACTION",
1271
+ "onUpdate": "CASCADE"
1272
+ }
1273
+ },
1274
+ "interaction_id": {
1275
+ "type": "UUID",
1276
+ "referenceKind": "foreignKey",
1277
+ "notNull": false,
1278
+ "unique": false,
1279
+ "foreignKey": {
1280
+ "table": "support_interactions",
1281
+ "column": "id",
1282
+ "onDelete": "NO ACTION",
1283
+ "onUpdate": "CASCADE"
1284
+ }
1285
+ },
1286
+ "phase": {
1287
+ "type": "TEXT",
1288
+ "notNull": false,
1289
+ "unique": false
1290
+ },
1291
+ "outcome": {
1292
+ "type": "TEXT",
1293
+ "notNull": false,
1294
+ "unique": false
1295
+ },
1296
+ "confidence": {
1297
+ "type": "REAL",
1298
+ "notNull": false,
1299
+ "unique": false
1300
+ },
1301
+ "classification": {
1302
+ "type": "TEXT",
1303
+ "notNull": false,
1304
+ "unique": false
1305
+ },
1306
+ "response_interaction_id": {
1307
+ "type": "UUID",
1308
+ "referenceKind": "foreignKey",
1309
+ "notNull": false,
1310
+ "unique": false,
1311
+ "foreignKey": {
1312
+ "table": "support_interactions",
1313
+ "column": "id",
1314
+ "onDelete": "NO ACTION",
1315
+ "onUpdate": "CASCADE"
1316
+ }
1317
+ },
1318
+ "knowledge_refs": {
1319
+ "type": "TEXT",
1320
+ "notNull": false,
1321
+ "unique": false
1322
+ },
1323
+ "tool_calls": {
1324
+ "type": "TEXT",
1325
+ "notNull": false,
1326
+ "unique": false
1327
+ },
1328
+ "error": {
1329
+ "type": "TEXT",
1330
+ "notNull": false,
1331
+ "unique": false
1332
+ },
1333
+ "correlation_id": {
1334
+ "type": "TEXT",
1335
+ "notNull": false,
1336
+ "unique": false
1337
+ },
1338
+ "model": {
1339
+ "type": "TEXT",
1340
+ "notNull": false,
1341
+ "unique": false
1342
+ },
1343
+ "started_at": {
1344
+ "type": "TIMESTAMP",
1345
+ "notNull": false,
1346
+ "unique": false
1347
+ },
1348
+ "completed_at": {
1349
+ "type": "TIMESTAMP",
1350
+ "notNull": false,
1351
+ "unique": false
1352
+ },
1353
+ "metadata": {
1354
+ "type": "TEXT",
1355
+ "notNull": false,
1356
+ "unique": false
1357
+ }
1358
+ },
1359
+ "indexes": [
1360
+ {
1361
+ "name": "support_ai_runs_slug_context_idx",
1362
+ "columns": [
1363
+ "tenant_id",
1364
+ "slug",
1365
+ "context"
1366
+ ],
1367
+ "unique": true,
1368
+ "nullsNotDistinct": true
1369
+ },
1370
+ {
1371
+ "name": "support_ai_runs_tenant_id_created_at_idx",
1372
+ "columns": [
1373
+ "tenant_id",
1374
+ "created_at"
1375
+ ]
1376
+ },
1377
+ {
1378
+ "name": "support_ai_runs_case_id_idx",
1379
+ "columns": [
1380
+ "case_id"
1381
+ ]
1382
+ },
1383
+ {
1384
+ "name": "support_ai_runs_interaction_id_idx",
1385
+ "columns": [
1386
+ "interaction_id"
1387
+ ]
1388
+ },
1389
+ {
1390
+ "name": "support_ai_runs_response_interaction_id_idx",
1391
+ "columns": [
1392
+ "response_interaction_id"
1393
+ ]
1394
+ }
1395
+ ],
1396
+ "version": "5edb948b"
1397
+ }
1398
+ },
1399
+ "@happyvertical/smrt-support:SupportCaseEvent": {
1400
+ "name": "supportcaseevent",
1401
+ "className": "SupportCaseEvent",
1402
+ "qualifiedName": "@happyvertical/smrt-support:SupportCaseEvent",
1403
+ "collection": "supportcaseevents",
1404
+ "filePath": "/home/runner/work/smrt/smrt/packages/support/src/models/support-case-event.ts",
1405
+ "packageName": "@happyvertical/smrt-support",
1406
+ "fields": {
1407
+ "tenantId": {
1408
+ "type": "text",
1409
+ "required": false,
1410
+ "_meta": {
1411
+ "sqlType": "UUID",
1412
+ "nullable": true,
1413
+ "__tenancy": {
1414
+ "isTenantIdField": true,
1415
+ "autoFilter": true,
1416
+ "required": false,
1417
+ "autoPopulate": true,
1418
+ "nullable": true,
1419
+ "mode": "optional",
1420
+ "field": "tenantId",
1421
+ "allowSuperAdminBypass": false
1422
+ }
1423
+ }
1424
+ },
1425
+ "caseId": {
1426
+ "type": "foreignKey",
1427
+ "required": true,
1428
+ "related": "SupportCase",
1429
+ "_meta": {
1430
+ "required": true
1431
+ }
1432
+ },
1433
+ "eventType": {
1112
1434
  "type": "text",
1113
1435
  "required": false,
1114
1436
  "_meta": {}
@@ -1291,7 +1613,8 @@
1291
1613
  "slug",
1292
1614
  "context"
1293
1615
  ],
1294
- "unique": true
1616
+ "unique": true,
1617
+ "nullsNotDistinct": true
1295
1618
  },
1296
1619
  {
1297
1620
  "name": "support_case_events_tenant_id_created_at_idx",
@@ -1357,7 +1680,7 @@
1357
1680
  "collectionExportName": "SupportCaseEventCollectionCollection",
1358
1681
  "schema": {
1359
1682
  "tableName": "support_case_events",
1360
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_case_events\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
1683
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_case_events\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"case_id\" UUID NOT NULL,\n \"event_type\" TEXT,\n \"actor_kind\" TEXT,\n \"actor_profile_id\" UUID,\n \"occurred_at\" TIMESTAMP,\n \"summary\" TEXT,\n \"payload\" TEXT\n);",
1361
1684
  "columns": {
1362
1685
  "id": {
1363
1686
  "type": "UUID",
@@ -1383,25 +1706,89 @@
1383
1706
  "type": "TIMESTAMP",
1384
1707
  "notNull": true,
1385
1708
  "default": "current_timestamp"
1709
+ },
1710
+ "tenant_id": {
1711
+ "type": "UUID",
1712
+ "referenceKind": "tenantId",
1713
+ "notNull": false,
1714
+ "unique": false
1715
+ },
1716
+ "case_id": {
1717
+ "type": "UUID",
1718
+ "referenceKind": "foreignKey",
1719
+ "notNull": true,
1720
+ "unique": false,
1721
+ "foreignKey": {
1722
+ "table": "support_cases",
1723
+ "column": "id",
1724
+ "onDelete": "NO ACTION",
1725
+ "onUpdate": "CASCADE"
1726
+ }
1727
+ },
1728
+ "event_type": {
1729
+ "type": "TEXT",
1730
+ "notNull": false,
1731
+ "unique": false
1732
+ },
1733
+ "actor_kind": {
1734
+ "type": "TEXT",
1735
+ "notNull": false,
1736
+ "unique": false
1737
+ },
1738
+ "actor_profile_id": {
1739
+ "type": "UUID",
1740
+ "referenceKind": "crossPackageRef",
1741
+ "notNull": false,
1742
+ "unique": false
1743
+ },
1744
+ "occurred_at": {
1745
+ "type": "TIMESTAMP",
1746
+ "notNull": false,
1747
+ "unique": false
1748
+ },
1749
+ "summary": {
1750
+ "type": "TEXT",
1751
+ "notNull": false,
1752
+ "unique": false
1753
+ },
1754
+ "payload": {
1755
+ "type": "TEXT",
1756
+ "notNull": false,
1757
+ "unique": false
1386
1758
  }
1387
1759
  },
1388
1760
  "indexes": [
1389
1761
  {
1390
1762
  "name": "support_case_events_slug_context_idx",
1391
1763
  "columns": [
1764
+ "tenant_id",
1392
1765
  "slug",
1393
1766
  "context"
1394
1767
  ],
1395
- "unique": true
1768
+ "unique": true,
1769
+ "nullsNotDistinct": true
1396
1770
  },
1397
1771
  {
1398
- "name": "support_case_events_created_at_idx",
1772
+ "name": "support_case_events_tenant_id_created_at_idx",
1399
1773
  "columns": [
1774
+ "tenant_id",
1400
1775
  "created_at"
1401
1776
  ]
1777
+ },
1778
+ {
1779
+ "name": "support_case_events_case_id_idx",
1780
+ "columns": [
1781
+ "case_id"
1782
+ ]
1783
+ },
1784
+ {
1785
+ "name": "support_case_events_actor_profile_id_idx",
1786
+ "columns": [
1787
+ "actor_profile_id"
1788
+ ]
1402
1789
  }
1403
1790
  ],
1404
- "version": "15415d2b"
1791
+ "version": "eff9cadb"
1405
1792
  }
1406
1793
  },
1407
1794
  "@happyvertical/smrt-support:SupportCase": {
@@ -1957,7 +2344,8 @@
1957
2344
  "slug",
1958
2345
  "context"
1959
2346
  ],
1960
- "unique": true
2347
+ "unique": true,
2348
+ "nullsNotDistinct": true
1961
2349
  },
1962
2350
  {
1963
2351
  "name": "support_cases_tenant_id_created_at_idx",
@@ -2074,7 +2462,7 @@
2074
2462
  "collectionExportName": "SupportCaseCollectionCollection",
2075
2463
  "schema": {
2076
2464
  "tableName": "support_cases",
2077
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_cases\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
2465
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_cases\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"case_number\" TEXT,\n \"subject\" TEXT,\n \"description\" TEXT,\n \"status\" TEXT,\n \"priority\" TEXT,\n \"severity\" TEXT,\n \"category\" TEXT,\n \"sensitive\" BOOLEAN,\n \"channel_kind\" TEXT,\n \"client_profile_id\" UUID,\n \"opened_by_profile_id\" UUID,\n \"project_id\" TEXT,\n \"binding_id\" UUID,\n \"thread_key\" TEXT,\n \"plan_id\" UUID,\n \"plan_snapshot\" TEXT,\n \"assigned_specialist_id\" UUID,\n \"assigned_at\" TIMESTAMP,\n \"preferred_specialist_id\" UUID,\n \"escalation_level\" INTEGER DEFAULT 0,\n \"escalated_at\" TIMESTAMP,\n \"acknowledged_at\" TIMESTAMP,\n \"first_responded_at\" TIMESTAMP,\n \"human_requested_at\" TIMESTAMP,\n \"resolved_at\" TIMESTAMP,\n \"resolved_by_profile_id\" UUID,\n \"resolution_kind\" TEXT,\n \"resolution_summary\" TEXT,\n \"closed_at\" TIMESTAMP,\n \"reopen_count\" INTEGER DEFAULT 0,\n \"last_reopened_at\" TIMESTAMP,\n \"ai_enabled\" BOOLEAN,\n \"metadata\" TEXT\n);",
2078
2466
  "columns": {
2079
2467
  "id": {
2080
2468
  "type": "UUID",
@@ -2100,25 +2488,274 @@
2100
2488
  "type": "TIMESTAMP",
2101
2489
  "notNull": true,
2102
2490
  "default": "current_timestamp"
2103
- }
2104
- },
2105
- "indexes": [
2106
- {
2107
- "name": "support_cases_slug_context_idx",
2108
- "columns": [
2109
- "slug",
2110
- "context"
2111
- ],
2112
- "unique": true
2113
2491
  },
2492
+ "tenant_id": {
2493
+ "type": "UUID",
2494
+ "referenceKind": "tenantId",
2495
+ "notNull": false,
2496
+ "unique": false
2497
+ },
2498
+ "case_number": {
2499
+ "type": "TEXT",
2500
+ "notNull": false,
2501
+ "unique": false
2502
+ },
2503
+ "subject": {
2504
+ "type": "TEXT",
2505
+ "notNull": false,
2506
+ "unique": false
2507
+ },
2508
+ "description": {
2509
+ "type": "TEXT",
2510
+ "notNull": false,
2511
+ "unique": false
2512
+ },
2513
+ "status": {
2514
+ "type": "TEXT",
2515
+ "notNull": false,
2516
+ "unique": false
2517
+ },
2518
+ "priority": {
2519
+ "type": "TEXT",
2520
+ "notNull": false,
2521
+ "unique": false
2522
+ },
2523
+ "severity": {
2524
+ "type": "TEXT",
2525
+ "notNull": false,
2526
+ "unique": false
2527
+ },
2528
+ "category": {
2529
+ "type": "TEXT",
2530
+ "notNull": false,
2531
+ "unique": false
2532
+ },
2533
+ "sensitive": {
2534
+ "type": "BOOLEAN",
2535
+ "notNull": false,
2536
+ "unique": false
2537
+ },
2538
+ "channel_kind": {
2539
+ "type": "TEXT",
2540
+ "notNull": false,
2541
+ "unique": false
2542
+ },
2543
+ "client_profile_id": {
2544
+ "type": "UUID",
2545
+ "referenceKind": "crossPackageRef",
2546
+ "notNull": false,
2547
+ "unique": false
2548
+ },
2549
+ "opened_by_profile_id": {
2550
+ "type": "UUID",
2551
+ "referenceKind": "crossPackageRef",
2552
+ "notNull": false,
2553
+ "unique": false
2554
+ },
2555
+ "project_id": {
2556
+ "type": "TEXT",
2557
+ "notNull": false,
2558
+ "unique": false
2559
+ },
2560
+ "binding_id": {
2561
+ "type": "UUID",
2562
+ "referenceKind": "foreignKey",
2563
+ "notNull": false,
2564
+ "unique": false,
2565
+ "foreignKey": {
2566
+ "table": "support_channel_bindings",
2567
+ "column": "id",
2568
+ "onDelete": "NO ACTION",
2569
+ "onUpdate": "CASCADE"
2570
+ }
2571
+ },
2572
+ "thread_key": {
2573
+ "type": "TEXT",
2574
+ "notNull": false,
2575
+ "unique": false
2576
+ },
2577
+ "plan_id": {
2578
+ "type": "UUID",
2579
+ "referenceKind": "foreignKey",
2580
+ "notNull": false,
2581
+ "unique": false,
2582
+ "foreignKey": {
2583
+ "table": "support_plans",
2584
+ "column": "id",
2585
+ "onDelete": "NO ACTION",
2586
+ "onUpdate": "CASCADE"
2587
+ }
2588
+ },
2589
+ "plan_snapshot": {
2590
+ "type": "TEXT",
2591
+ "notNull": false,
2592
+ "unique": false
2593
+ },
2594
+ "assigned_specialist_id": {
2595
+ "type": "UUID",
2596
+ "referenceKind": "foreignKey",
2597
+ "notNull": false,
2598
+ "unique": false,
2599
+ "foreignKey": {
2600
+ "table": "support_specialists",
2601
+ "column": "id",
2602
+ "onDelete": "NO ACTION",
2603
+ "onUpdate": "CASCADE"
2604
+ }
2605
+ },
2606
+ "assigned_at": {
2607
+ "type": "TIMESTAMP",
2608
+ "notNull": false,
2609
+ "unique": false
2610
+ },
2611
+ "preferred_specialist_id": {
2612
+ "type": "UUID",
2613
+ "referenceKind": "foreignKey",
2614
+ "notNull": false,
2615
+ "unique": false,
2616
+ "foreignKey": {
2617
+ "table": "support_specialists",
2618
+ "column": "id",
2619
+ "onDelete": "NO ACTION",
2620
+ "onUpdate": "CASCADE"
2621
+ }
2622
+ },
2623
+ "escalation_level": {
2624
+ "type": "INTEGER",
2625
+ "notNull": false,
2626
+ "unique": false,
2627
+ "default": 0
2628
+ },
2629
+ "escalated_at": {
2630
+ "type": "TIMESTAMP",
2631
+ "notNull": false,
2632
+ "unique": false
2633
+ },
2634
+ "acknowledged_at": {
2635
+ "type": "TIMESTAMP",
2636
+ "notNull": false,
2637
+ "unique": false
2638
+ },
2639
+ "first_responded_at": {
2640
+ "type": "TIMESTAMP",
2641
+ "notNull": false,
2642
+ "unique": false
2643
+ },
2644
+ "human_requested_at": {
2645
+ "type": "TIMESTAMP",
2646
+ "notNull": false,
2647
+ "unique": false
2648
+ },
2649
+ "resolved_at": {
2650
+ "type": "TIMESTAMP",
2651
+ "notNull": false,
2652
+ "unique": false
2653
+ },
2654
+ "resolved_by_profile_id": {
2655
+ "type": "UUID",
2656
+ "referenceKind": "crossPackageRef",
2657
+ "notNull": false,
2658
+ "unique": false
2659
+ },
2660
+ "resolution_kind": {
2661
+ "type": "TEXT",
2662
+ "notNull": false,
2663
+ "unique": false
2664
+ },
2665
+ "resolution_summary": {
2666
+ "type": "TEXT",
2667
+ "notNull": false,
2668
+ "unique": false
2669
+ },
2670
+ "closed_at": {
2671
+ "type": "TIMESTAMP",
2672
+ "notNull": false,
2673
+ "unique": false
2674
+ },
2675
+ "reopen_count": {
2676
+ "type": "INTEGER",
2677
+ "notNull": false,
2678
+ "unique": false,
2679
+ "default": 0
2680
+ },
2681
+ "last_reopened_at": {
2682
+ "type": "TIMESTAMP",
2683
+ "notNull": false,
2684
+ "unique": false
2685
+ },
2686
+ "ai_enabled": {
2687
+ "type": "BOOLEAN",
2688
+ "notNull": false,
2689
+ "unique": false
2690
+ },
2691
+ "metadata": {
2692
+ "type": "TEXT",
2693
+ "notNull": false,
2694
+ "unique": false
2695
+ }
2696
+ },
2697
+ "indexes": [
2114
2698
  {
2115
- "name": "support_cases_created_at_idx",
2699
+ "name": "support_cases_slug_context_idx",
2116
2700
  "columns": [
2701
+ "tenant_id",
2702
+ "slug",
2703
+ "context"
2704
+ ],
2705
+ "unique": true,
2706
+ "nullsNotDistinct": true
2707
+ },
2708
+ {
2709
+ "name": "support_cases_tenant_id_created_at_idx",
2710
+ "columns": [
2711
+ "tenant_id",
2117
2712
  "created_at"
2118
2713
  ]
2714
+ },
2715
+ {
2716
+ "name": "support_cases_client_profile_id_idx",
2717
+ "columns": [
2718
+ "client_profile_id"
2719
+ ]
2720
+ },
2721
+ {
2722
+ "name": "support_cases_opened_by_profile_id_idx",
2723
+ "columns": [
2724
+ "opened_by_profile_id"
2725
+ ]
2726
+ },
2727
+ {
2728
+ "name": "support_cases_binding_id_idx",
2729
+ "columns": [
2730
+ "binding_id"
2731
+ ]
2732
+ },
2733
+ {
2734
+ "name": "support_cases_plan_id_idx",
2735
+ "columns": [
2736
+ "plan_id"
2737
+ ]
2738
+ },
2739
+ {
2740
+ "name": "support_cases_assigned_specialist_id_idx",
2741
+ "columns": [
2742
+ "assigned_specialist_id"
2743
+ ]
2744
+ },
2745
+ {
2746
+ "name": "support_cases_preferred_specialist_id_idx",
2747
+ "columns": [
2748
+ "preferred_specialist_id"
2749
+ ]
2750
+ },
2751
+ {
2752
+ "name": "support_cases_resolved_by_profile_id_idx",
2753
+ "columns": [
2754
+ "resolved_by_profile_id"
2755
+ ]
2119
2756
  }
2120
2757
  ],
2121
- "version": "a0ea314b"
2758
+ "version": "b83a4283"
2122
2759
  }
2123
2760
  },
2124
2761
  "@happyvertical/smrt-support:SupportChannelBinding": {
@@ -2395,7 +3032,8 @@
2395
3032
  "target_type",
2396
3033
  "target_id"
2397
3034
  ],
2398
- "unique": true
3035
+ "unique": true,
3036
+ "nullsNotDistinct": true
2399
3037
  },
2400
3038
  {
2401
3039
  "name": "support_channel_bindings_slug_context_idx",
@@ -2465,7 +3103,7 @@
2465
3103
  "collectionExportName": "SupportChannelBindingCollectionCollection",
2466
3104
  "schema": {
2467
3105
  "tableName": "support_channel_bindings",
2468
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_channel_bindings\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
3106
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_channel_bindings\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"binding_kind\" TEXT,\n \"channel_kind\" TEXT,\n \"target_type\" TEXT,\n \"target_id\" TEXT,\n \"client_profile_id\" UUID,\n \"project_id\" TEXT,\n \"plan_id\" UUID,\n \"enabled\" BOOLEAN,\n \"self_addresses\" TEXT,\n \"metadata\" TEXT\n);",
2469
3107
  "columns": {
2470
3108
  "id": {
2471
3109
  "type": "UUID",
@@ -2491,25 +3129,116 @@
2491
3129
  "type": "TIMESTAMP",
2492
3130
  "notNull": true,
2493
3131
  "default": "current_timestamp"
3132
+ },
3133
+ "tenant_id": {
3134
+ "type": "UUID",
3135
+ "referenceKind": "tenantId",
3136
+ "notNull": false,
3137
+ "unique": false
3138
+ },
3139
+ "name": {
3140
+ "type": "TEXT",
3141
+ "notNull": false,
3142
+ "unique": false,
3143
+ "default": ""
3144
+ },
3145
+ "binding_kind": {
3146
+ "type": "TEXT",
3147
+ "notNull": false,
3148
+ "unique": false
3149
+ },
3150
+ "channel_kind": {
3151
+ "type": "TEXT",
3152
+ "notNull": false,
3153
+ "unique": false
3154
+ },
3155
+ "target_type": {
3156
+ "type": "TEXT",
3157
+ "notNull": false,
3158
+ "unique": false
3159
+ },
3160
+ "target_id": {
3161
+ "type": "TEXT",
3162
+ "notNull": false,
3163
+ "unique": false
3164
+ },
3165
+ "client_profile_id": {
3166
+ "type": "UUID",
3167
+ "referenceKind": "crossPackageRef",
3168
+ "notNull": false,
3169
+ "unique": false
3170
+ },
3171
+ "project_id": {
3172
+ "type": "TEXT",
3173
+ "notNull": false,
3174
+ "unique": false
3175
+ },
3176
+ "plan_id": {
3177
+ "type": "UUID",
3178
+ "referenceKind": "foreignKey",
3179
+ "notNull": false,
3180
+ "unique": false,
3181
+ "foreignKey": {
3182
+ "table": "support_plans",
3183
+ "column": "id",
3184
+ "onDelete": "NO ACTION",
3185
+ "onUpdate": "CASCADE"
3186
+ }
3187
+ },
3188
+ "enabled": {
3189
+ "type": "BOOLEAN",
3190
+ "notNull": false,
3191
+ "unique": false
3192
+ },
3193
+ "self_addresses": {
3194
+ "type": "TEXT",
3195
+ "notNull": false,
3196
+ "unique": false
3197
+ },
3198
+ "metadata": {
3199
+ "type": "TEXT",
3200
+ "notNull": false,
3201
+ "unique": false
2494
3202
  }
2495
3203
  },
2496
3204
  "indexes": [
3205
+ {
3206
+ "name": "support_channel_bindings_target_type_target_id_idx",
3207
+ "columns": [
3208
+ "target_type",
3209
+ "target_id"
3210
+ ],
3211
+ "unique": true,
3212
+ "nullsNotDistinct": true
3213
+ },
2497
3214
  {
2498
3215
  "name": "support_channel_bindings_slug_context_idx",
2499
3216
  "columns": [
2500
3217
  "slug",
2501
3218
  "context"
2502
- ],
2503
- "unique": true
3219
+ ]
2504
3220
  },
2505
3221
  {
2506
- "name": "support_channel_bindings_created_at_idx",
3222
+ "name": "support_channel_bindings_tenant_id_created_at_idx",
2507
3223
  "columns": [
3224
+ "tenant_id",
2508
3225
  "created_at"
2509
3226
  ]
3227
+ },
3228
+ {
3229
+ "name": "support_channel_bindings_client_profile_id_idx",
3230
+ "columns": [
3231
+ "client_profile_id"
3232
+ ]
3233
+ },
3234
+ {
3235
+ "name": "support_channel_bindings_plan_id_idx",
3236
+ "columns": [
3237
+ "plan_id"
3238
+ ]
2510
3239
  }
2511
3240
  ],
2512
- "version": "662a042a"
3241
+ "version": "f162d069"
2513
3242
  }
2514
3243
  },
2515
3244
  "@happyvertical/smrt-support:SupportCompensationPlan": {
@@ -2740,7 +3469,8 @@
2740
3469
  "specialist_id",
2741
3470
  "effective_from"
2742
3471
  ],
2743
- "unique": true
3472
+ "unique": true,
3473
+ "nullsNotDistinct": true
2744
3474
  },
2745
3475
  {
2746
3476
  "name": "support_compensation_plans_slug_context_idx",
@@ -2812,7 +3542,7 @@
2812
3542
  "collectionExportName": "SupportCompensationPlanCollectionCollection",
2813
3543
  "schema": {
2814
3544
  "tableName": "support_compensation_plans",
2815
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_compensation_plans\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
3545
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_compensation_plans\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"specialist_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"hourly_rate\" REAL DEFAULT 0,\n \"currency\" TEXT,\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"status\" TEXT,\n \"terms\" TEXT\n);",
2816
3546
  "columns": {
2817
3547
  "id": {
2818
3548
  "type": "UUID",
@@ -2838,25 +3568,96 @@
2838
3568
  "type": "TIMESTAMP",
2839
3569
  "notNull": true,
2840
3570
  "default": "current_timestamp"
3571
+ },
3572
+ "tenant_id": {
3573
+ "type": "UUID",
3574
+ "referenceKind": "tenantId",
3575
+ "notNull": false,
3576
+ "unique": false
3577
+ },
3578
+ "specialist_id": {
3579
+ "type": "UUID",
3580
+ "referenceKind": "foreignKey",
3581
+ "notNull": false,
3582
+ "unique": false,
3583
+ "foreignKey": {
3584
+ "table": "support_specialists",
3585
+ "column": "id",
3586
+ "onDelete": "CASCADE",
3587
+ "onUpdate": "CASCADE"
3588
+ }
3589
+ },
3590
+ "name": {
3591
+ "type": "TEXT",
3592
+ "notNull": false,
3593
+ "unique": false,
3594
+ "default": ""
3595
+ },
3596
+ "hourly_rate": {
3597
+ "type": "REAL",
3598
+ "notNull": false,
3599
+ "unique": false,
3600
+ "default": 0
3601
+ },
3602
+ "currency": {
3603
+ "type": "TEXT",
3604
+ "notNull": false,
3605
+ "unique": false
3606
+ },
3607
+ "effective_from": {
3608
+ "type": "TIMESTAMP",
3609
+ "notNull": false,
3610
+ "unique": false
3611
+ },
3612
+ "effective_to": {
3613
+ "type": "TIMESTAMP",
3614
+ "notNull": false,
3615
+ "unique": false
3616
+ },
3617
+ "status": {
3618
+ "type": "TEXT",
3619
+ "notNull": false,
3620
+ "unique": false
3621
+ },
3622
+ "terms": {
3623
+ "type": "TEXT",
3624
+ "notNull": false,
3625
+ "unique": false
2841
3626
  }
2842
3627
  },
2843
3628
  "indexes": [
3629
+ {
3630
+ "name": "support_compensation_plans_tenant_id_specialist_id_idx",
3631
+ "columns": [
3632
+ "tenant_id",
3633
+ "specialist_id",
3634
+ "effective_from"
3635
+ ],
3636
+ "unique": true,
3637
+ "nullsNotDistinct": true
3638
+ },
2844
3639
  {
2845
3640
  "name": "support_compensation_plans_slug_context_idx",
2846
3641
  "columns": [
2847
3642
  "slug",
2848
3643
  "context"
2849
- ],
2850
- "unique": true
3644
+ ]
2851
3645
  },
2852
3646
  {
2853
- "name": "support_compensation_plans_created_at_idx",
3647
+ "name": "support_compensation_plans_tenant_id_created_at_idx",
2854
3648
  "columns": [
3649
+ "tenant_id",
2855
3650
  "created_at"
2856
3651
  ]
3652
+ },
3653
+ {
3654
+ "name": "support_compensation_plans_specialist_id_idx",
3655
+ "columns": [
3656
+ "specialist_id"
3657
+ ]
2857
3658
  }
2858
3659
  ],
2859
- "version": "121b3db1"
3660
+ "version": "1c6b40cd"
2860
3661
  }
2861
3662
  },
2862
3663
  "@happyvertical/smrt-support:SupportInteraction": {
@@ -3126,7 +3927,8 @@
3126
3927
  "columns": [
3127
3928
  "source_key"
3128
3929
  ],
3129
- "unique": true
3930
+ "unique": true,
3931
+ "nullsNotDistinct": true
3130
3932
  },
3131
3933
  {
3132
3934
  "name": "support_interactions_slug_context_idx",
@@ -3219,7 +4021,7 @@
3219
4021
  "collectionExportName": "SupportInteractionCollectionCollection",
3220
4022
  "schema": {
3221
4023
  "tableName": "support_interactions",
3222
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_interactions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
4024
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_interactions\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"case_id\" UUID NOT NULL,\n \"direction\" TEXT,\n \"channel_kind\" TEXT,\n \"actor_kind\" TEXT,\n \"author_profile_id\" UUID,\n \"occurred_at\" TIMESTAMP,\n \"body\" TEXT,\n \"source_type\" TEXT,\n \"source_id\" TEXT,\n \"source_key\" TEXT,\n \"rfc_message_id\" TEXT,\n \"metadata\" TEXT\n);",
3223
4025
  "columns": {
3224
4026
  "id": {
3225
4027
  "type": "UUID",
@@ -3227,43 +4029,137 @@
3227
4029
  "referenceKind": "id",
3228
4030
  "notNull": true
3229
4031
  },
3230
- "slug": {
4032
+ "slug": {
4033
+ "type": "TEXT",
4034
+ "notNull": true
4035
+ },
4036
+ "context": {
4037
+ "type": "TEXT",
4038
+ "notNull": true,
4039
+ "default": ""
4040
+ },
4041
+ "created_at": {
4042
+ "type": "TIMESTAMP",
4043
+ "notNull": true,
4044
+ "default": "current_timestamp"
4045
+ },
4046
+ "updated_at": {
4047
+ "type": "TIMESTAMP",
4048
+ "notNull": true,
4049
+ "default": "current_timestamp"
4050
+ },
4051
+ "tenant_id": {
4052
+ "type": "UUID",
4053
+ "referenceKind": "tenantId",
4054
+ "notNull": false,
4055
+ "unique": false
4056
+ },
4057
+ "case_id": {
4058
+ "type": "UUID",
4059
+ "referenceKind": "foreignKey",
4060
+ "notNull": true,
4061
+ "unique": false,
4062
+ "foreignKey": {
4063
+ "table": "support_cases",
4064
+ "column": "id",
4065
+ "onDelete": "NO ACTION",
4066
+ "onUpdate": "CASCADE"
4067
+ }
4068
+ },
4069
+ "direction": {
4070
+ "type": "TEXT",
4071
+ "notNull": false,
4072
+ "unique": false
4073
+ },
4074
+ "channel_kind": {
4075
+ "type": "TEXT",
4076
+ "notNull": false,
4077
+ "unique": false
4078
+ },
4079
+ "actor_kind": {
4080
+ "type": "TEXT",
4081
+ "notNull": false,
4082
+ "unique": false
4083
+ },
4084
+ "author_profile_id": {
4085
+ "type": "UUID",
4086
+ "referenceKind": "crossPackageRef",
4087
+ "notNull": false,
4088
+ "unique": false
4089
+ },
4090
+ "occurred_at": {
4091
+ "type": "TIMESTAMP",
4092
+ "notNull": false,
4093
+ "unique": false
4094
+ },
4095
+ "body": {
3231
4096
  "type": "TEXT",
3232
- "notNull": true
4097
+ "notNull": false,
4098
+ "unique": false
3233
4099
  },
3234
- "context": {
4100
+ "source_type": {
3235
4101
  "type": "TEXT",
3236
- "notNull": true,
3237
- "default": ""
4102
+ "notNull": false,
4103
+ "unique": false
3238
4104
  },
3239
- "created_at": {
3240
- "type": "TIMESTAMP",
3241
- "notNull": true,
3242
- "default": "current_timestamp"
4105
+ "source_id": {
4106
+ "type": "TEXT",
4107
+ "notNull": false,
4108
+ "unique": false
3243
4109
  },
3244
- "updated_at": {
3245
- "type": "TIMESTAMP",
3246
- "notNull": true,
3247
- "default": "current_timestamp"
4110
+ "source_key": {
4111
+ "type": "TEXT",
4112
+ "notNull": false,
4113
+ "unique": false
4114
+ },
4115
+ "rfc_message_id": {
4116
+ "type": "TEXT",
4117
+ "notNull": false,
4118
+ "unique": false
4119
+ },
4120
+ "metadata": {
4121
+ "type": "TEXT",
4122
+ "notNull": false,
4123
+ "unique": false
3248
4124
  }
3249
4125
  },
3250
4126
  "indexes": [
4127
+ {
4128
+ "name": "support_interactions_source_key_idx",
4129
+ "columns": [
4130
+ "source_key"
4131
+ ],
4132
+ "unique": true,
4133
+ "nullsNotDistinct": true
4134
+ },
3251
4135
  {
3252
4136
  "name": "support_interactions_slug_context_idx",
3253
4137
  "columns": [
3254
4138
  "slug",
3255
4139
  "context"
3256
- ],
3257
- "unique": true
4140
+ ]
3258
4141
  },
3259
4142
  {
3260
- "name": "support_interactions_created_at_idx",
4143
+ "name": "support_interactions_tenant_id_created_at_idx",
3261
4144
  "columns": [
4145
+ "tenant_id",
3262
4146
  "created_at"
3263
4147
  ]
4148
+ },
4149
+ {
4150
+ "name": "support_interactions_case_id_idx",
4151
+ "columns": [
4152
+ "case_id"
4153
+ ]
4154
+ },
4155
+ {
4156
+ "name": "support_interactions_author_profile_id_idx",
4157
+ "columns": [
4158
+ "author_profile_id"
4159
+ ]
3264
4160
  }
3265
4161
  ],
3266
- "version": "b1c57eb7"
4162
+ "version": "83ae00a1"
3267
4163
  }
3268
4164
  },
3269
4165
  "@happyvertical/smrt-support:SupportPlan": {
@@ -3643,9 +4539,209 @@
3643
4539
  "mode": "optional"
3644
4540
  }
3645
4541
  },
3646
- "extends": "SmrtObject",
3647
- "exportName": "SupportPlan",
3648
- "collectionExportName": "SupportPlanCollection",
4542
+ "extends": "SmrtObject",
4543
+ "exportName": "SupportPlan",
4544
+ "collectionExportName": "SupportPlanCollection",
4545
+ "schema": {
4546
+ "tableName": "support_plans",
4547
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_plans\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"plan_key\" TEXT,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT,\n \"status\" TEXT,\n \"channels\" TEXT,\n \"timezone\" TEXT,\n \"coverage\" TEXT,\n \"holidays\" TEXT,\n \"severity_definitions\" TEXT,\n \"targets\" TEXT,\n \"pause_statuses\" TEXT,\n \"escalation_policy\" TEXT,\n \"availability_fee_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT,\n \"included_minutes\" INTEGER DEFAULT 0,\n \"overage_hourly_rate\" REAL DEFAULT 0,\n \"on_call_hourly_rate\" REAL DEFAULT 0,\n \"time_approval_policy\" TEXT,\n \"subscription_plan_key\" TEXT,\n \"metadata\" TEXT\n);",
4548
+ "columns": {
4549
+ "id": {
4550
+ "type": "UUID",
4551
+ "primaryKey": true,
4552
+ "referenceKind": "id",
4553
+ "notNull": true
4554
+ },
4555
+ "slug": {
4556
+ "type": "TEXT",
4557
+ "notNull": true
4558
+ },
4559
+ "context": {
4560
+ "type": "TEXT",
4561
+ "notNull": true,
4562
+ "default": ""
4563
+ },
4564
+ "created_at": {
4565
+ "type": "TIMESTAMP",
4566
+ "notNull": true,
4567
+ "default": "current_timestamp"
4568
+ },
4569
+ "updated_at": {
4570
+ "type": "TIMESTAMP",
4571
+ "notNull": true,
4572
+ "default": "current_timestamp"
4573
+ },
4574
+ "tenant_id": {
4575
+ "type": "UUID",
4576
+ "referenceKind": "tenantId",
4577
+ "notNull": false,
4578
+ "unique": false
4579
+ },
4580
+ "plan_key": {
4581
+ "type": "TEXT",
4582
+ "notNull": false,
4583
+ "unique": false
4584
+ },
4585
+ "name": {
4586
+ "type": "TEXT",
4587
+ "notNull": false,
4588
+ "unique": false,
4589
+ "default": ""
4590
+ },
4591
+ "description": {
4592
+ "type": "TEXT",
4593
+ "notNull": false,
4594
+ "unique": false
4595
+ },
4596
+ "status": {
4597
+ "type": "TEXT",
4598
+ "notNull": false,
4599
+ "unique": false
4600
+ },
4601
+ "channels": {
4602
+ "type": "TEXT",
4603
+ "notNull": false,
4604
+ "unique": false
4605
+ },
4606
+ "timezone": {
4607
+ "type": "TEXT",
4608
+ "notNull": false,
4609
+ "unique": false
4610
+ },
4611
+ "coverage": {
4612
+ "type": "TEXT",
4613
+ "notNull": false,
4614
+ "unique": false
4615
+ },
4616
+ "holidays": {
4617
+ "type": "TEXT",
4618
+ "notNull": false,
4619
+ "unique": false
4620
+ },
4621
+ "severity_definitions": {
4622
+ "type": "TEXT",
4623
+ "notNull": false,
4624
+ "unique": false
4625
+ },
4626
+ "targets": {
4627
+ "type": "TEXT",
4628
+ "notNull": false,
4629
+ "unique": false
4630
+ },
4631
+ "pause_statuses": {
4632
+ "type": "TEXT",
4633
+ "notNull": false,
4634
+ "unique": false
4635
+ },
4636
+ "escalation_policy": {
4637
+ "type": "TEXT",
4638
+ "notNull": false,
4639
+ "unique": false
4640
+ },
4641
+ "availability_fee_amount": {
4642
+ "type": "INTEGER",
4643
+ "notNull": false,
4644
+ "unique": false,
4645
+ "default": 0
4646
+ },
4647
+ "currency": {
4648
+ "type": "TEXT",
4649
+ "notNull": false,
4650
+ "unique": false
4651
+ },
4652
+ "included_minutes": {
4653
+ "type": "INTEGER",
4654
+ "notNull": false,
4655
+ "unique": false,
4656
+ "default": 0
4657
+ },
4658
+ "overage_hourly_rate": {
4659
+ "type": "REAL",
4660
+ "notNull": false,
4661
+ "unique": false,
4662
+ "default": 0
4663
+ },
4664
+ "on_call_hourly_rate": {
4665
+ "type": "REAL",
4666
+ "notNull": false,
4667
+ "unique": false,
4668
+ "default": 0
4669
+ },
4670
+ "time_approval_policy": {
4671
+ "type": "TEXT",
4672
+ "notNull": false,
4673
+ "unique": false
4674
+ },
4675
+ "subscription_plan_key": {
4676
+ "type": "TEXT",
4677
+ "notNull": false,
4678
+ "unique": false
4679
+ },
4680
+ "metadata": {
4681
+ "type": "TEXT",
4682
+ "notNull": false,
4683
+ "unique": false
4684
+ }
4685
+ },
4686
+ "indexes": [
4687
+ {
4688
+ "name": "support_plans_tenant_id_plan_key_idx",
4689
+ "columns": [
4690
+ "tenant_id",
4691
+ "plan_key"
4692
+ ],
4693
+ "unique": true,
4694
+ "nullsNotDistinct": true
4695
+ },
4696
+ {
4697
+ "name": "support_plans_slug_context_idx",
4698
+ "columns": [
4699
+ "slug",
4700
+ "context"
4701
+ ]
4702
+ },
4703
+ {
4704
+ "name": "support_plans_tenant_id_created_at_idx",
4705
+ "columns": [
4706
+ "tenant_id",
4707
+ "created_at"
4708
+ ]
4709
+ }
4710
+ ],
4711
+ "version": "492a9cf6"
4712
+ }
4713
+ },
4714
+ "@happyvertical/smrt-support:SupportPlanCollection": {
4715
+ "name": "supportplancollection",
4716
+ "className": "SupportPlanCollection",
4717
+ "qualifiedName": "@happyvertical/smrt-support:SupportPlanCollection",
4718
+ "collection": "supportplans",
4719
+ "filePath": "/home/runner/work/smrt/smrt/packages/support/src/models/support-plan.ts",
4720
+ "packageName": "@happyvertical/smrt-support",
4721
+ "fields": {},
4722
+ "methods": {
4723
+ "byPlanKey": {
4724
+ "name": "byPlanKey",
4725
+ "async": true,
4726
+ "parameters": [
4727
+ {
4728
+ "name": "planKey",
4729
+ "type": "string",
4730
+ "optional": false
4731
+ }
4732
+ ],
4733
+ "returnType": "Promise<SupportPlan | null>",
4734
+ "isStatic": false,
4735
+ "isPublic": true
4736
+ }
4737
+ },
4738
+ "decoratorConfig": {
4739
+ "tableName": "support_plans"
4740
+ },
4741
+ "extends": "SmrtCollection",
4742
+ "extendsTypeArg": "SupportPlan",
4743
+ "exportName": "SupportPlanCollection",
4744
+ "collectionExportName": "SupportPlanCollectionCollection",
3649
4745
  "schema": {
3650
4746
  "tableName": "support_plans",
3651
4747
  "ddl": "CREATE TABLE IF NOT EXISTS \"support_plans\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"plan_key\" TEXT,\n \"name\" TEXT DEFAULT '',\n \"description\" TEXT,\n \"status\" TEXT,\n \"channels\" TEXT,\n \"timezone\" TEXT,\n \"coverage\" TEXT,\n \"holidays\" TEXT,\n \"severity_definitions\" TEXT,\n \"targets\" TEXT,\n \"pause_statuses\" TEXT,\n \"escalation_policy\" TEXT,\n \"availability_fee_amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT,\n \"included_minutes\" INTEGER DEFAULT 0,\n \"overage_hourly_rate\" REAL DEFAULT 0,\n \"on_call_hourly_rate\" REAL DEFAULT 0,\n \"time_approval_policy\" TEXT,\n \"subscription_plan_key\" TEXT,\n \"metadata\" TEXT\n);",
@@ -3794,7 +4890,8 @@
3794
4890
  "tenant_id",
3795
4891
  "plan_key"
3796
4892
  ],
3797
- "unique": true
4893
+ "unique": true,
4894
+ "nullsNotDistinct": true
3798
4895
  },
3799
4896
  {
3800
4897
  "name": "support_plans_slug_context_idx",
@@ -3814,86 +4911,6 @@
3814
4911
  "version": "492a9cf6"
3815
4912
  }
3816
4913
  },
3817
- "@happyvertical/smrt-support:SupportPlanCollection": {
3818
- "name": "supportplancollection",
3819
- "className": "SupportPlanCollection",
3820
- "qualifiedName": "@happyvertical/smrt-support:SupportPlanCollection",
3821
- "collection": "supportplans",
3822
- "filePath": "/home/runner/work/smrt/smrt/packages/support/src/models/support-plan.ts",
3823
- "packageName": "@happyvertical/smrt-support",
3824
- "fields": {},
3825
- "methods": {
3826
- "byPlanKey": {
3827
- "name": "byPlanKey",
3828
- "async": true,
3829
- "parameters": [
3830
- {
3831
- "name": "planKey",
3832
- "type": "string",
3833
- "optional": false
3834
- }
3835
- ],
3836
- "returnType": "Promise<SupportPlan | null>",
3837
- "isStatic": false,
3838
- "isPublic": true
3839
- }
3840
- },
3841
- "decoratorConfig": {
3842
- "tableName": "support_plans"
3843
- },
3844
- "extends": "SmrtCollection",
3845
- "extendsTypeArg": "SupportPlan",
3846
- "exportName": "SupportPlanCollection",
3847
- "collectionExportName": "SupportPlanCollectionCollection",
3848
- "schema": {
3849
- "tableName": "support_plans",
3850
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_plans\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
3851
- "columns": {
3852
- "id": {
3853
- "type": "UUID",
3854
- "primaryKey": true,
3855
- "referenceKind": "id",
3856
- "notNull": true
3857
- },
3858
- "slug": {
3859
- "type": "TEXT",
3860
- "notNull": true
3861
- },
3862
- "context": {
3863
- "type": "TEXT",
3864
- "notNull": true,
3865
- "default": ""
3866
- },
3867
- "created_at": {
3868
- "type": "TIMESTAMP",
3869
- "notNull": true,
3870
- "default": "current_timestamp"
3871
- },
3872
- "updated_at": {
3873
- "type": "TIMESTAMP",
3874
- "notNull": true,
3875
- "default": "current_timestamp"
3876
- }
3877
- },
3878
- "indexes": [
3879
- {
3880
- "name": "support_plans_slug_context_idx",
3881
- "columns": [
3882
- "slug",
3883
- "context"
3884
- ],
3885
- "unique": true
3886
- },
3887
- {
3888
- "name": "support_plans_created_at_idx",
3889
- "columns": [
3890
- "created_at"
3891
- ]
3892
- }
3893
- ],
3894
- "version": "a2548347"
3895
- }
3896
- },
3897
4914
  "@happyvertical/smrt-support:SupportPolicy": {
3898
4915
  "name": "supportpolicy",
3899
4916
  "className": "SupportPolicy",
@@ -4246,7 +5263,8 @@
4246
5263
  "tenant_id",
4247
5264
  "name"
4248
5265
  ],
4249
- "unique": true
5266
+ "unique": true,
5267
+ "nullsNotDistinct": true
4250
5268
  },
4251
5269
  {
4252
5270
  "name": "support_policies_slug_context_idx",
@@ -4308,7 +5326,7 @@
4308
5326
  "collectionExportName": "SupportPolicyCollectionCollection",
4309
5327
  "schema": {
4310
5328
  "tableName": "support_policies",
4311
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_policies\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
5329
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_policies\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"name\" TEXT DEFAULT '',\n \"plan_id\" UUID,\n \"project_id\" TEXT,\n \"enabled\" BOOLEAN,\n \"auto_acknowledge\" BOOLEAN,\n \"auto_classify\" BOOLEAN,\n \"auto_answer\" BOOLEAN,\n \"auto_troubleshoot\" BOOLEAN,\n \"auto_resolve\" BOOLEAN,\n \"auto_resolve_max_severity\" TEXT,\n \"confidence_threshold\" REAL DEFAULT 0.7,\n \"max_auto_attempts\" INTEGER DEFAULT 1,\n \"auto_send_email_replies\" BOOLEAN,\n \"sensitive_categories\" TEXT,\n \"allowed_tools\" TEXT,\n \"metadata\" TEXT\n);",
4312
5330
  "columns": {
4313
5331
  "id": {
4314
5332
  "type": "UUID",
@@ -4334,25 +5352,136 @@
4334
5352
  "type": "TIMESTAMP",
4335
5353
  "notNull": true,
4336
5354
  "default": "current_timestamp"
5355
+ },
5356
+ "tenant_id": {
5357
+ "type": "UUID",
5358
+ "referenceKind": "tenantId",
5359
+ "notNull": false,
5360
+ "unique": false
5361
+ },
5362
+ "name": {
5363
+ "type": "TEXT",
5364
+ "notNull": false,
5365
+ "unique": false,
5366
+ "default": ""
5367
+ },
5368
+ "plan_id": {
5369
+ "type": "UUID",
5370
+ "referenceKind": "foreignKey",
5371
+ "notNull": false,
5372
+ "unique": false,
5373
+ "foreignKey": {
5374
+ "table": "support_plans",
5375
+ "column": "id",
5376
+ "onDelete": "NO ACTION",
5377
+ "onUpdate": "CASCADE"
5378
+ }
5379
+ },
5380
+ "project_id": {
5381
+ "type": "TEXT",
5382
+ "notNull": false,
5383
+ "unique": false
5384
+ },
5385
+ "enabled": {
5386
+ "type": "BOOLEAN",
5387
+ "notNull": false,
5388
+ "unique": false
5389
+ },
5390
+ "auto_acknowledge": {
5391
+ "type": "BOOLEAN",
5392
+ "notNull": false,
5393
+ "unique": false
5394
+ },
5395
+ "auto_classify": {
5396
+ "type": "BOOLEAN",
5397
+ "notNull": false,
5398
+ "unique": false
5399
+ },
5400
+ "auto_answer": {
5401
+ "type": "BOOLEAN",
5402
+ "notNull": false,
5403
+ "unique": false
5404
+ },
5405
+ "auto_troubleshoot": {
5406
+ "type": "BOOLEAN",
5407
+ "notNull": false,
5408
+ "unique": false
5409
+ },
5410
+ "auto_resolve": {
5411
+ "type": "BOOLEAN",
5412
+ "notNull": false,
5413
+ "unique": false
5414
+ },
5415
+ "auto_resolve_max_severity": {
5416
+ "type": "TEXT",
5417
+ "notNull": false,
5418
+ "unique": false
5419
+ },
5420
+ "confidence_threshold": {
5421
+ "type": "REAL",
5422
+ "notNull": false,
5423
+ "unique": false,
5424
+ "default": 0.7
5425
+ },
5426
+ "max_auto_attempts": {
5427
+ "type": "INTEGER",
5428
+ "notNull": false,
5429
+ "unique": false,
5430
+ "default": 1
5431
+ },
5432
+ "auto_send_email_replies": {
5433
+ "type": "BOOLEAN",
5434
+ "notNull": false,
5435
+ "unique": false
5436
+ },
5437
+ "sensitive_categories": {
5438
+ "type": "TEXT",
5439
+ "notNull": false,
5440
+ "unique": false
5441
+ },
5442
+ "allowed_tools": {
5443
+ "type": "TEXT",
5444
+ "notNull": false,
5445
+ "unique": false
5446
+ },
5447
+ "metadata": {
5448
+ "type": "TEXT",
5449
+ "notNull": false,
5450
+ "unique": false
4337
5451
  }
4338
5452
  },
4339
5453
  "indexes": [
5454
+ {
5455
+ "name": "support_policies_tenant_id_name_idx",
5456
+ "columns": [
5457
+ "tenant_id",
5458
+ "name"
5459
+ ],
5460
+ "unique": true,
5461
+ "nullsNotDistinct": true
5462
+ },
4340
5463
  {
4341
5464
  "name": "support_policies_slug_context_idx",
4342
5465
  "columns": [
4343
5466
  "slug",
4344
5467
  "context"
4345
- ],
4346
- "unique": true
5468
+ ]
4347
5469
  },
4348
5470
  {
4349
- "name": "support_policies_created_at_idx",
5471
+ "name": "support_policies_tenant_id_created_at_idx",
4350
5472
  "columns": [
5473
+ "tenant_id",
4351
5474
  "created_at"
4352
5475
  ]
5476
+ },
5477
+ {
5478
+ "name": "support_policies_plan_id_idx",
5479
+ "columns": [
5480
+ "plan_id"
5481
+ ]
4353
5482
  }
4354
5483
  ],
4355
- "version": "555a3403"
5484
+ "version": "61b60e25"
4356
5485
  }
4357
5486
  },
4358
5487
  "@happyvertical/smrt-support:SupportServiceTarget": {
@@ -4673,7 +5802,8 @@
4673
5802
  "target_type",
4674
5803
  "cycle"
4675
5804
  ],
4676
- "unique": true
5805
+ "unique": true,
5806
+ "nullsNotDistinct": true
4677
5807
  },
4678
5808
  {
4679
5809
  "name": "support_service_targets_slug_context_idx",
@@ -4745,7 +5875,7 @@
4745
5875
  "collectionExportName": "SupportServiceTargetCollectionCollection",
4746
5876
  "schema": {
4747
5877
  "tableName": "support_service_targets",
4748
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_service_targets\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
5878
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_service_targets\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"case_id\" UUID NOT NULL,\n \"target_type\" TEXT,\n \"cycle\" INTEGER DEFAULT 0,\n \"severity\" TEXT,\n \"base_minutes\" INTEGER DEFAULT 0,\n \"started_at\" TIMESTAMP,\n \"due_at\" TIMESTAMP,\n \"status\" TEXT,\n \"paused_at\" TIMESTAMP,\n \"paused_total_seconds\" INTEGER DEFAULT 0,\n \"satisfied_at\" TIMESTAMP,\n \"breached_at\" TIMESTAMP,\n \"cancelled_at\" TIMESTAMP,\n \"escalation_job_id\" TEXT,\n \"metadata\" TEXT\n);",
4749
5879
  "columns": {
4750
5880
  "id": {
4751
5881
  "type": "UUID",
@@ -4753,43 +5883,144 @@
4753
5883
  "referenceKind": "id",
4754
5884
  "notNull": true
4755
5885
  },
4756
- "slug": {
5886
+ "slug": {
5887
+ "type": "TEXT",
5888
+ "notNull": true
5889
+ },
5890
+ "context": {
5891
+ "type": "TEXT",
5892
+ "notNull": true,
5893
+ "default": ""
5894
+ },
5895
+ "created_at": {
5896
+ "type": "TIMESTAMP",
5897
+ "notNull": true,
5898
+ "default": "current_timestamp"
5899
+ },
5900
+ "updated_at": {
5901
+ "type": "TIMESTAMP",
5902
+ "notNull": true,
5903
+ "default": "current_timestamp"
5904
+ },
5905
+ "tenant_id": {
5906
+ "type": "UUID",
5907
+ "referenceKind": "tenantId",
5908
+ "notNull": false,
5909
+ "unique": false
5910
+ },
5911
+ "case_id": {
5912
+ "type": "UUID",
5913
+ "referenceKind": "foreignKey",
5914
+ "notNull": true,
5915
+ "unique": false,
5916
+ "foreignKey": {
5917
+ "table": "support_cases",
5918
+ "column": "id",
5919
+ "onDelete": "CASCADE",
5920
+ "onUpdate": "CASCADE"
5921
+ }
5922
+ },
5923
+ "target_type": {
5924
+ "type": "TEXT",
5925
+ "notNull": false,
5926
+ "unique": false
5927
+ },
5928
+ "cycle": {
5929
+ "type": "INTEGER",
5930
+ "notNull": false,
5931
+ "unique": false,
5932
+ "default": 0
5933
+ },
5934
+ "severity": {
4757
5935
  "type": "TEXT",
4758
- "notNull": true
5936
+ "notNull": false,
5937
+ "unique": false
4759
5938
  },
4760
- "context": {
5939
+ "base_minutes": {
5940
+ "type": "INTEGER",
5941
+ "notNull": false,
5942
+ "unique": false,
5943
+ "default": 0
5944
+ },
5945
+ "started_at": {
5946
+ "type": "TIMESTAMP",
5947
+ "notNull": false,
5948
+ "unique": false
5949
+ },
5950
+ "due_at": {
5951
+ "type": "TIMESTAMP",
5952
+ "notNull": false,
5953
+ "unique": false
5954
+ },
5955
+ "status": {
4761
5956
  "type": "TEXT",
4762
- "notNull": true,
4763
- "default": ""
5957
+ "notNull": false,
5958
+ "unique": false
4764
5959
  },
4765
- "created_at": {
5960
+ "paused_at": {
4766
5961
  "type": "TIMESTAMP",
4767
- "notNull": true,
4768
- "default": "current_timestamp"
5962
+ "notNull": false,
5963
+ "unique": false
4769
5964
  },
4770
- "updated_at": {
5965
+ "paused_total_seconds": {
5966
+ "type": "INTEGER",
5967
+ "notNull": false,
5968
+ "unique": false,
5969
+ "default": 0
5970
+ },
5971
+ "satisfied_at": {
4771
5972
  "type": "TIMESTAMP",
4772
- "notNull": true,
4773
- "default": "current_timestamp"
5973
+ "notNull": false,
5974
+ "unique": false
5975
+ },
5976
+ "breached_at": {
5977
+ "type": "TIMESTAMP",
5978
+ "notNull": false,
5979
+ "unique": false
5980
+ },
5981
+ "cancelled_at": {
5982
+ "type": "TIMESTAMP",
5983
+ "notNull": false,
5984
+ "unique": false
5985
+ },
5986
+ "escalation_job_id": {
5987
+ "type": "TEXT",
5988
+ "notNull": false,
5989
+ "unique": false
5990
+ },
5991
+ "metadata": {
5992
+ "type": "TEXT",
5993
+ "notNull": false,
5994
+ "unique": false
4774
5995
  }
4775
5996
  },
4776
5997
  "indexes": [
5998
+ {
5999
+ "name": "support_service_targets_case_id_target_type_idx",
6000
+ "columns": [
6001
+ "case_id",
6002
+ "target_type",
6003
+ "cycle"
6004
+ ],
6005
+ "unique": true,
6006
+ "nullsNotDistinct": true
6007
+ },
4777
6008
  {
4778
6009
  "name": "support_service_targets_slug_context_idx",
4779
6010
  "columns": [
4780
6011
  "slug",
4781
6012
  "context"
4782
- ],
4783
- "unique": true
6013
+ ]
4784
6014
  },
4785
6015
  {
4786
- "name": "support_service_targets_created_at_idx",
6016
+ "name": "support_service_targets_tenant_id_created_at_idx",
4787
6017
  "columns": [
6018
+ "tenant_id",
4788
6019
  "created_at"
4789
6020
  ]
4790
6021
  }
4791
6022
  ],
4792
- "version": "f201a103"
6023
+ "version": "40614be1"
4793
6024
  }
4794
6025
  },
4795
6026
  "@happyvertical/smrt-support:SupportEscalation": {
@@ -5067,7 +6298,8 @@
5067
6298
  "slug",
5068
6299
  "context"
5069
6300
  ],
5070
- "unique": true
6301
+ "unique": true,
6302
+ "nullsNotDistinct": true
5071
6303
  },
5072
6304
  {
5073
6305
  "name": "support_escalations_tenant_id_created_at_idx",
@@ -5137,7 +6369,7 @@
5137
6369
  "collectionExportName": "SupportEscalationCollectionCollection",
5138
6370
  "schema": {
5139
6371
  "tableName": "support_escalations",
5140
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_escalations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
6372
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_escalations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"case_id\" UUID NOT NULL,\n \"level\" INTEGER DEFAULT 1,\n \"reason\" TEXT,\n \"target_id\" UUID,\n \"target_type\" TEXT,\n \"action\" TEXT,\n \"from_specialist_id\" UUID,\n \"to_specialist_id\" UUID,\n \"notified_profile_ids\" TEXT,\n \"occurred_at\" TIMESTAMP,\n \"note\" TEXT\n);",
5141
6373
  "columns": {
5142
6374
  "id": {
5143
6375
  "type": "UUID",
@@ -5163,25 +6395,142 @@
5163
6395
  "type": "TIMESTAMP",
5164
6396
  "notNull": true,
5165
6397
  "default": "current_timestamp"
6398
+ },
6399
+ "tenant_id": {
6400
+ "type": "UUID",
6401
+ "referenceKind": "tenantId",
6402
+ "notNull": false,
6403
+ "unique": false
6404
+ },
6405
+ "case_id": {
6406
+ "type": "UUID",
6407
+ "referenceKind": "foreignKey",
6408
+ "notNull": true,
6409
+ "unique": false,
6410
+ "foreignKey": {
6411
+ "table": "support_cases",
6412
+ "column": "id",
6413
+ "onDelete": "NO ACTION",
6414
+ "onUpdate": "CASCADE"
6415
+ }
6416
+ },
6417
+ "level": {
6418
+ "type": "INTEGER",
6419
+ "notNull": false,
6420
+ "unique": false,
6421
+ "default": 1
6422
+ },
6423
+ "reason": {
6424
+ "type": "TEXT",
6425
+ "notNull": false,
6426
+ "unique": false
6427
+ },
6428
+ "target_id": {
6429
+ "type": "UUID",
6430
+ "referenceKind": "foreignKey",
6431
+ "notNull": false,
6432
+ "unique": false,
6433
+ "foreignKey": {
6434
+ "table": "support_service_targets",
6435
+ "column": "id",
6436
+ "onDelete": "NO ACTION",
6437
+ "onUpdate": "CASCADE"
6438
+ }
6439
+ },
6440
+ "target_type": {
6441
+ "type": "TEXT",
6442
+ "notNull": false,
6443
+ "unique": false
6444
+ },
6445
+ "action": {
6446
+ "type": "TEXT",
6447
+ "notNull": false,
6448
+ "unique": false
6449
+ },
6450
+ "from_specialist_id": {
6451
+ "type": "UUID",
6452
+ "referenceKind": "foreignKey",
6453
+ "notNull": false,
6454
+ "unique": false,
6455
+ "foreignKey": {
6456
+ "table": "support_specialists",
6457
+ "column": "id",
6458
+ "onDelete": "NO ACTION",
6459
+ "onUpdate": "CASCADE"
6460
+ }
6461
+ },
6462
+ "to_specialist_id": {
6463
+ "type": "UUID",
6464
+ "referenceKind": "foreignKey",
6465
+ "notNull": false,
6466
+ "unique": false,
6467
+ "foreignKey": {
6468
+ "table": "support_specialists",
6469
+ "column": "id",
6470
+ "onDelete": "NO ACTION",
6471
+ "onUpdate": "CASCADE"
6472
+ }
6473
+ },
6474
+ "notified_profile_ids": {
6475
+ "type": "TEXT",
6476
+ "notNull": false,
6477
+ "unique": false
6478
+ },
6479
+ "occurred_at": {
6480
+ "type": "TIMESTAMP",
6481
+ "notNull": false,
6482
+ "unique": false
6483
+ },
6484
+ "note": {
6485
+ "type": "TEXT",
6486
+ "notNull": false,
6487
+ "unique": false
5166
6488
  }
5167
6489
  },
5168
6490
  "indexes": [
5169
6491
  {
5170
6492
  "name": "support_escalations_slug_context_idx",
5171
6493
  "columns": [
6494
+ "tenant_id",
5172
6495
  "slug",
5173
6496
  "context"
5174
6497
  ],
5175
- "unique": true
6498
+ "unique": true,
6499
+ "nullsNotDistinct": true
5176
6500
  },
5177
6501
  {
5178
- "name": "support_escalations_created_at_idx",
6502
+ "name": "support_escalations_tenant_id_created_at_idx",
5179
6503
  "columns": [
6504
+ "tenant_id",
5180
6505
  "created_at"
5181
6506
  ]
6507
+ },
6508
+ {
6509
+ "name": "support_escalations_case_id_idx",
6510
+ "columns": [
6511
+ "case_id"
6512
+ ]
6513
+ },
6514
+ {
6515
+ "name": "support_escalations_target_id_idx",
6516
+ "columns": [
6517
+ "target_id"
6518
+ ]
6519
+ },
6520
+ {
6521
+ "name": "support_escalations_from_specialist_id_idx",
6522
+ "columns": [
6523
+ "from_specialist_id"
6524
+ ]
6525
+ },
6526
+ {
6527
+ "name": "support_escalations_to_specialist_id_idx",
6528
+ "columns": [
6529
+ "to_specialist_id"
6530
+ ]
5182
6531
  }
5183
6532
  ],
5184
- "version": "f9b3556a"
6533
+ "version": "493f2a61"
5185
6534
  }
5186
6535
  },
5187
6536
  "@happyvertical/smrt-support:SupportCharge": {
@@ -5529,51 +6878,155 @@
5529
6878
  "collectionExportName": "SupportChargeCollectionCollection",
5530
6879
  "schema": {
5531
6880
  "tableName": "support_charges",
5532
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_charges\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
6881
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_charges\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"time_entry_id\" UUID NOT NULL,\n \"case_id\" UUID,\n \"plan_id\" UUID,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT,\n \"billable_seconds\" INTEGER DEFAULT 0,\n \"included_seconds_applied\" INTEGER DEFAULT 0,\n \"rate_snapshot\" TEXT,\n \"status\" TEXT,\n \"finalized_at\" TIMESTAMP,\n \"metadata\" TEXT\n);",
5533
6882
  "columns": {
5534
6883
  "id": {
5535
6884
  "type": "UUID",
5536
- "primaryKey": true,
5537
- "referenceKind": "id",
5538
- "notNull": true
6885
+ "primaryKey": true,
6886
+ "referenceKind": "id",
6887
+ "notNull": true
6888
+ },
6889
+ "slug": {
6890
+ "type": "TEXT",
6891
+ "notNull": true
6892
+ },
6893
+ "context": {
6894
+ "type": "TEXT",
6895
+ "notNull": true,
6896
+ "default": ""
6897
+ },
6898
+ "created_at": {
6899
+ "type": "TIMESTAMP",
6900
+ "notNull": true,
6901
+ "default": "current_timestamp"
6902
+ },
6903
+ "updated_at": {
6904
+ "type": "TIMESTAMP",
6905
+ "notNull": true,
6906
+ "default": "current_timestamp"
6907
+ },
6908
+ "tenant_id": {
6909
+ "type": "UUID",
6910
+ "referenceKind": "tenantId",
6911
+ "notNull": false,
6912
+ "unique": false
6913
+ },
6914
+ "time_entry_id": {
6915
+ "type": "UUID",
6916
+ "referenceKind": "foreignKey",
6917
+ "notNull": true,
6918
+ "unique": false,
6919
+ "foreignKey": {
6920
+ "table": "service_time_entries",
6921
+ "column": "id",
6922
+ "onDelete": "CASCADE",
6923
+ "onUpdate": "CASCADE"
6924
+ }
6925
+ },
6926
+ "case_id": {
6927
+ "type": "UUID",
6928
+ "referenceKind": "foreignKey",
6929
+ "notNull": false,
6930
+ "unique": false,
6931
+ "foreignKey": {
6932
+ "table": "support_cases",
6933
+ "column": "id",
6934
+ "onDelete": "NO ACTION",
6935
+ "onUpdate": "CASCADE"
6936
+ }
6937
+ },
6938
+ "plan_id": {
6939
+ "type": "UUID",
6940
+ "referenceKind": "foreignKey",
6941
+ "notNull": false,
6942
+ "unique": false,
6943
+ "foreignKey": {
6944
+ "table": "support_plans",
6945
+ "column": "id",
6946
+ "onDelete": "NO ACTION",
6947
+ "onUpdate": "CASCADE"
6948
+ }
5539
6949
  },
5540
- "slug": {
6950
+ "amount": {
6951
+ "type": "INTEGER",
6952
+ "notNull": false,
6953
+ "unique": false,
6954
+ "default": 0
6955
+ },
6956
+ "currency": {
5541
6957
  "type": "TEXT",
5542
- "notNull": true
6958
+ "notNull": false,
6959
+ "unique": false
5543
6960
  },
5544
- "context": {
6961
+ "billable_seconds": {
6962
+ "type": "INTEGER",
6963
+ "notNull": false,
6964
+ "unique": false,
6965
+ "default": 0
6966
+ },
6967
+ "included_seconds_applied": {
6968
+ "type": "INTEGER",
6969
+ "notNull": false,
6970
+ "unique": false,
6971
+ "default": 0
6972
+ },
6973
+ "rate_snapshot": {
5545
6974
  "type": "TEXT",
5546
- "notNull": true,
5547
- "default": ""
6975
+ "notNull": false,
6976
+ "unique": false
5548
6977
  },
5549
- "created_at": {
5550
- "type": "TIMESTAMP",
5551
- "notNull": true,
5552
- "default": "current_timestamp"
6978
+ "status": {
6979
+ "type": "TEXT",
6980
+ "notNull": false,
6981
+ "unique": false
5553
6982
  },
5554
- "updated_at": {
6983
+ "finalized_at": {
5555
6984
  "type": "TIMESTAMP",
5556
- "notNull": true,
5557
- "default": "current_timestamp"
6985
+ "notNull": false,
6986
+ "unique": false
6987
+ },
6988
+ "metadata": {
6989
+ "type": "TEXT",
6990
+ "notNull": false,
6991
+ "unique": false
5558
6992
  }
5559
6993
  },
5560
6994
  "indexes": [
6995
+ {
6996
+ "name": "support_charges_time_entry_id_idx",
6997
+ "columns": [
6998
+ "time_entry_id"
6999
+ ],
7000
+ "unique": true
7001
+ },
5561
7002
  {
5562
7003
  "name": "support_charges_slug_context_idx",
5563
7004
  "columns": [
5564
7005
  "slug",
5565
7006
  "context"
5566
- ],
5567
- "unique": true
7007
+ ]
5568
7008
  },
5569
7009
  {
5570
- "name": "support_charges_created_at_idx",
7010
+ "name": "support_charges_tenant_id_created_at_idx",
5571
7011
  "columns": [
7012
+ "tenant_id",
5572
7013
  "created_at"
5573
7014
  ]
7015
+ },
7016
+ {
7017
+ "name": "support_charges_case_id_idx",
7018
+ "columns": [
7019
+ "case_id"
7020
+ ]
7021
+ },
7022
+ {
7023
+ "name": "support_charges_plan_id_idx",
7024
+ "columns": [
7025
+ "plan_id"
7026
+ ]
5574
7027
  }
5575
7028
  ],
5576
- "version": "6853d84d"
7029
+ "version": "44f149fb"
5577
7030
  }
5578
7031
  },
5579
7032
  "@happyvertical/smrt-support:SupportCompensation": {
@@ -5910,7 +7363,7 @@
5910
7363
  "collectionExportName": "SupportCompensationCollectionCollection",
5911
7364
  "schema": {
5912
7365
  "tableName": "support_compensations",
5913
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_compensations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
7366
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_compensations\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"time_entry_id\" UUID NOT NULL,\n \"specialist_id\" UUID,\n \"compensation_plan_id\" UUID,\n \"amount\" INTEGER DEFAULT 0,\n \"currency\" TEXT,\n \"payable_seconds\" INTEGER DEFAULT 0,\n \"rate_snapshot\" TEXT,\n \"status\" TEXT,\n \"finalized_at\" TIMESTAMP,\n \"metadata\" TEXT\n);",
5914
7367
  "columns": {
5915
7368
  "id": {
5916
7369
  "type": "UUID",
@@ -5936,25 +7389,123 @@
5936
7389
  "type": "TIMESTAMP",
5937
7390
  "notNull": true,
5938
7391
  "default": "current_timestamp"
7392
+ },
7393
+ "tenant_id": {
7394
+ "type": "UUID",
7395
+ "referenceKind": "tenantId",
7396
+ "notNull": false,
7397
+ "unique": false
7398
+ },
7399
+ "time_entry_id": {
7400
+ "type": "UUID",
7401
+ "referenceKind": "foreignKey",
7402
+ "notNull": true,
7403
+ "unique": false,
7404
+ "foreignKey": {
7405
+ "table": "service_time_entries",
7406
+ "column": "id",
7407
+ "onDelete": "CASCADE",
7408
+ "onUpdate": "CASCADE"
7409
+ }
7410
+ },
7411
+ "specialist_id": {
7412
+ "type": "UUID",
7413
+ "referenceKind": "foreignKey",
7414
+ "notNull": false,
7415
+ "unique": false,
7416
+ "foreignKey": {
7417
+ "table": "support_specialists",
7418
+ "column": "id",
7419
+ "onDelete": "NO ACTION",
7420
+ "onUpdate": "CASCADE"
7421
+ }
7422
+ },
7423
+ "compensation_plan_id": {
7424
+ "type": "UUID",
7425
+ "referenceKind": "foreignKey",
7426
+ "notNull": false,
7427
+ "unique": false,
7428
+ "foreignKey": {
7429
+ "table": "support_compensation_plans",
7430
+ "column": "id",
7431
+ "onDelete": "NO ACTION",
7432
+ "onUpdate": "CASCADE"
7433
+ }
7434
+ },
7435
+ "amount": {
7436
+ "type": "INTEGER",
7437
+ "notNull": false,
7438
+ "unique": false,
7439
+ "default": 0
7440
+ },
7441
+ "currency": {
7442
+ "type": "TEXT",
7443
+ "notNull": false,
7444
+ "unique": false
7445
+ },
7446
+ "payable_seconds": {
7447
+ "type": "INTEGER",
7448
+ "notNull": false,
7449
+ "unique": false,
7450
+ "default": 0
7451
+ },
7452
+ "rate_snapshot": {
7453
+ "type": "TEXT",
7454
+ "notNull": false,
7455
+ "unique": false
7456
+ },
7457
+ "status": {
7458
+ "type": "TEXT",
7459
+ "notNull": false,
7460
+ "unique": false
7461
+ },
7462
+ "finalized_at": {
7463
+ "type": "TIMESTAMP",
7464
+ "notNull": false,
7465
+ "unique": false
7466
+ },
7467
+ "metadata": {
7468
+ "type": "TEXT",
7469
+ "notNull": false,
7470
+ "unique": false
5939
7471
  }
5940
7472
  },
5941
7473
  "indexes": [
7474
+ {
7475
+ "name": "support_compensations_time_entry_id_idx",
7476
+ "columns": [
7477
+ "time_entry_id"
7478
+ ],
7479
+ "unique": true
7480
+ },
5942
7481
  {
5943
7482
  "name": "support_compensations_slug_context_idx",
5944
7483
  "columns": [
5945
7484
  "slug",
5946
7485
  "context"
5947
- ],
5948
- "unique": true
7486
+ ]
5949
7487
  },
5950
7488
  {
5951
- "name": "support_compensations_created_at_idx",
7489
+ "name": "support_compensations_tenant_id_created_at_idx",
5952
7490
  "columns": [
7491
+ "tenant_id",
5953
7492
  "created_at"
5954
7493
  ]
7494
+ },
7495
+ {
7496
+ "name": "support_compensations_specialist_id_idx",
7497
+ "columns": [
7498
+ "specialist_id"
7499
+ ]
7500
+ },
7501
+ {
7502
+ "name": "support_compensations_compensation_plan_id_idx",
7503
+ "columns": [
7504
+ "compensation_plan_id"
7505
+ ]
5955
7506
  }
5956
7507
  ],
5957
- "version": "ec88df4e"
7508
+ "version": "f9de8296"
5958
7509
  }
5959
7510
  },
5960
7511
  "@happyvertical/smrt-support:SupportSpecialist": {
@@ -6215,7 +7766,8 @@
6215
7766
  "tenant_id",
6216
7767
  "profile_id"
6217
7768
  ],
6218
- "unique": true
7769
+ "unique": true,
7770
+ "nullsNotDistinct": true
6219
7771
  },
6220
7772
  {
6221
7773
  "name": "support_specialists_slug_context_idx",
@@ -6282,7 +7834,7 @@
6282
7834
  "collectionExportName": "SupportSpecialistCollectionCollection",
6283
7835
  "schema": {
6284
7836
  "tableName": "support_specialists",
6285
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_specialists\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
7837
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_specialists\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"profile_id\" UUID NOT NULL,\n \"display_name\" TEXT,\n \"status\" TEXT,\n \"languages\" TEXT,\n \"timezone\" TEXT,\n \"max_concurrent_cases\" INTEGER DEFAULT 10,\n \"on_call_priority\" INTEGER DEFAULT 0,\n \"notes\" TEXT,\n \"metadata\" TEXT\n);",
6286
7838
  "columns": {
6287
7839
  "id": {
6288
7840
  "type": "UUID",
@@ -6290,43 +7842,112 @@
6290
7842
  "referenceKind": "id",
6291
7843
  "notNull": true
6292
7844
  },
6293
- "slug": {
7845
+ "slug": {
7846
+ "type": "TEXT",
7847
+ "notNull": true
7848
+ },
7849
+ "context": {
7850
+ "type": "TEXT",
7851
+ "notNull": true,
7852
+ "default": ""
7853
+ },
7854
+ "created_at": {
7855
+ "type": "TIMESTAMP",
7856
+ "notNull": true,
7857
+ "default": "current_timestamp"
7858
+ },
7859
+ "updated_at": {
7860
+ "type": "TIMESTAMP",
7861
+ "notNull": true,
7862
+ "default": "current_timestamp"
7863
+ },
7864
+ "tenant_id": {
7865
+ "type": "UUID",
7866
+ "referenceKind": "tenantId",
7867
+ "notNull": false,
7868
+ "unique": false
7869
+ },
7870
+ "profile_id": {
7871
+ "type": "UUID",
7872
+ "referenceKind": "crossPackageRef",
7873
+ "notNull": true,
7874
+ "unique": false
7875
+ },
7876
+ "display_name": {
7877
+ "type": "TEXT",
7878
+ "notNull": false,
7879
+ "unique": false
7880
+ },
7881
+ "status": {
7882
+ "type": "TEXT",
7883
+ "notNull": false,
7884
+ "unique": false
7885
+ },
7886
+ "languages": {
7887
+ "type": "TEXT",
7888
+ "notNull": false,
7889
+ "unique": false
7890
+ },
7891
+ "timezone": {
7892
+ "type": "TEXT",
7893
+ "notNull": false,
7894
+ "unique": false
7895
+ },
7896
+ "max_concurrent_cases": {
7897
+ "type": "INTEGER",
7898
+ "notNull": false,
7899
+ "unique": false,
7900
+ "default": 10
7901
+ },
7902
+ "on_call_priority": {
7903
+ "type": "INTEGER",
7904
+ "notNull": false,
7905
+ "unique": false,
7906
+ "default": 0
7907
+ },
7908
+ "notes": {
6294
7909
  "type": "TEXT",
6295
- "notNull": true
7910
+ "notNull": false,
7911
+ "unique": false
6296
7912
  },
6297
- "context": {
7913
+ "metadata": {
6298
7914
  "type": "TEXT",
6299
- "notNull": true,
6300
- "default": ""
6301
- },
6302
- "created_at": {
6303
- "type": "TIMESTAMP",
6304
- "notNull": true,
6305
- "default": "current_timestamp"
6306
- },
6307
- "updated_at": {
6308
- "type": "TIMESTAMP",
6309
- "notNull": true,
6310
- "default": "current_timestamp"
7915
+ "notNull": false,
7916
+ "unique": false
6311
7917
  }
6312
7918
  },
6313
7919
  "indexes": [
7920
+ {
7921
+ "name": "support_specialists_tenant_id_profile_id_idx",
7922
+ "columns": [
7923
+ "tenant_id",
7924
+ "profile_id"
7925
+ ],
7926
+ "unique": true,
7927
+ "nullsNotDistinct": true
7928
+ },
6314
7929
  {
6315
7930
  "name": "support_specialists_slug_context_idx",
6316
7931
  "columns": [
6317
7932
  "slug",
6318
7933
  "context"
6319
- ],
6320
- "unique": true
7934
+ ]
6321
7935
  },
6322
7936
  {
6323
- "name": "support_specialists_created_at_idx",
7937
+ "name": "support_specialists_tenant_id_created_at_idx",
6324
7938
  "columns": [
7939
+ "tenant_id",
6325
7940
  "created_at"
6326
7941
  ]
7942
+ },
7943
+ {
7944
+ "name": "support_specialists_profile_id_idx",
7945
+ "columns": [
7946
+ "profile_id"
7947
+ ]
6327
7948
  }
6328
7949
  ],
6329
- "version": "65dfee96"
7950
+ "version": "ff5305d3"
6330
7951
  }
6331
7952
  },
6332
7953
  "@happyvertical/smrt-support:SupportQualification": {
@@ -6538,7 +8159,8 @@
6538
8159
  "specialist_id",
6539
8160
  "project_id"
6540
8161
  ],
6541
- "unique": true
8162
+ "unique": true,
8163
+ "nullsNotDistinct": true
6542
8164
  },
6543
8165
  {
6544
8166
  "name": "support_qualifications_slug_context_idx",
@@ -6611,7 +8233,7 @@
6611
8233
  "collectionExportName": "SupportQualificationCollectionCollection",
6612
8234
  "schema": {
6613
8235
  "tableName": "support_qualifications",
6614
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_qualifications\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
8236
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_qualifications\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"specialist_id\" UUID NOT NULL,\n \"project_id\" TEXT,\n \"level\" TEXT,\n \"effective_from\" TIMESTAMP,\n \"effective_to\" TIMESTAMP,\n \"granted_by_profile_id\" UUID,\n \"notes\" TEXT\n);",
6615
8237
  "columns": {
6616
8238
  "id": {
6617
8239
  "type": "UUID",
@@ -6637,25 +8259,89 @@
6637
8259
  "type": "TIMESTAMP",
6638
8260
  "notNull": true,
6639
8261
  "default": "current_timestamp"
8262
+ },
8263
+ "tenant_id": {
8264
+ "type": "UUID",
8265
+ "referenceKind": "tenantId",
8266
+ "notNull": false,
8267
+ "unique": false
8268
+ },
8269
+ "specialist_id": {
8270
+ "type": "UUID",
8271
+ "referenceKind": "foreignKey",
8272
+ "notNull": true,
8273
+ "unique": false,
8274
+ "foreignKey": {
8275
+ "table": "support_specialists",
8276
+ "column": "id",
8277
+ "onDelete": "CASCADE",
8278
+ "onUpdate": "CASCADE"
8279
+ }
8280
+ },
8281
+ "project_id": {
8282
+ "type": "TEXT",
8283
+ "notNull": false,
8284
+ "unique": false
8285
+ },
8286
+ "level": {
8287
+ "type": "TEXT",
8288
+ "notNull": false,
8289
+ "unique": false
8290
+ },
8291
+ "effective_from": {
8292
+ "type": "TIMESTAMP",
8293
+ "notNull": false,
8294
+ "unique": false
8295
+ },
8296
+ "effective_to": {
8297
+ "type": "TIMESTAMP",
8298
+ "notNull": false,
8299
+ "unique": false
8300
+ },
8301
+ "granted_by_profile_id": {
8302
+ "type": "UUID",
8303
+ "referenceKind": "crossPackageRef",
8304
+ "notNull": false,
8305
+ "unique": false
8306
+ },
8307
+ "notes": {
8308
+ "type": "TEXT",
8309
+ "notNull": false,
8310
+ "unique": false
6640
8311
  }
6641
8312
  },
6642
8313
  "indexes": [
8314
+ {
8315
+ "name": "support_qualifications_specialist_id_project_id_idx",
8316
+ "columns": [
8317
+ "specialist_id",
8318
+ "project_id"
8319
+ ],
8320
+ "unique": true,
8321
+ "nullsNotDistinct": true
8322
+ },
6643
8323
  {
6644
8324
  "name": "support_qualifications_slug_context_idx",
6645
8325
  "columns": [
6646
8326
  "slug",
6647
8327
  "context"
6648
- ],
6649
- "unique": true
8328
+ ]
6650
8329
  },
6651
8330
  {
6652
- "name": "support_qualifications_created_at_idx",
8331
+ "name": "support_qualifications_tenant_id_created_at_idx",
6653
8332
  "columns": [
8333
+ "tenant_id",
6654
8334
  "created_at"
6655
8335
  ]
8336
+ },
8337
+ {
8338
+ "name": "support_qualifications_granted_by_profile_id_idx",
8339
+ "columns": [
8340
+ "granted_by_profile_id"
8341
+ ]
6656
8342
  }
6657
8343
  ],
6658
- "version": "a0c2e59b"
8344
+ "version": "566b3428"
6659
8345
  }
6660
8346
  },
6661
8347
  "@happyvertical/smrt-support:SupportAvailability": {
@@ -6864,7 +8550,8 @@
6864
8550
  "slug",
6865
8551
  "context"
6866
8552
  ],
6867
- "unique": true
8553
+ "unique": true,
8554
+ "nullsNotDistinct": true
6868
8555
  },
6869
8556
  {
6870
8557
  "name": "support_availability_windows_tenant_id_created_at_idx",
@@ -6916,7 +8603,7 @@
6916
8603
  "collectionExportName": "SupportAvailabilityCollectionCollection",
6917
8604
  "schema": {
6918
8605
  "tableName": "support_availability_windows",
6919
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_availability_windows\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
8606
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_availability_windows\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"specialist_id\" UUID NOT NULL,\n \"kind\" TEXT,\n \"weekday\" INTEGER,\n \"start_minute\" INTEGER DEFAULT 0,\n \"end_minute\" INTEGER DEFAULT 0,\n \"starts_at\" TIMESTAMP,\n \"ends_at\" TIMESTAMP,\n \"notes\" TEXT\n);",
6920
8607
  "columns": {
6921
8608
  "id": {
6922
8609
  "type": "UUID",
@@ -6942,25 +8629,89 @@
6942
8629
  "type": "TIMESTAMP",
6943
8630
  "notNull": true,
6944
8631
  "default": "current_timestamp"
8632
+ },
8633
+ "tenant_id": {
8634
+ "type": "UUID",
8635
+ "referenceKind": "tenantId",
8636
+ "notNull": false,
8637
+ "unique": false
8638
+ },
8639
+ "specialist_id": {
8640
+ "type": "UUID",
8641
+ "referenceKind": "foreignKey",
8642
+ "notNull": true,
8643
+ "unique": false,
8644
+ "foreignKey": {
8645
+ "table": "support_specialists",
8646
+ "column": "id",
8647
+ "onDelete": "NO ACTION",
8648
+ "onUpdate": "CASCADE"
8649
+ }
8650
+ },
8651
+ "kind": {
8652
+ "type": "TEXT",
8653
+ "notNull": false,
8654
+ "unique": false
8655
+ },
8656
+ "weekday": {
8657
+ "type": "INTEGER",
8658
+ "notNull": false,
8659
+ "unique": false
8660
+ },
8661
+ "start_minute": {
8662
+ "type": "INTEGER",
8663
+ "notNull": false,
8664
+ "unique": false,
8665
+ "default": 0
8666
+ },
8667
+ "end_minute": {
8668
+ "type": "INTEGER",
8669
+ "notNull": false,
8670
+ "unique": false,
8671
+ "default": 0
8672
+ },
8673
+ "starts_at": {
8674
+ "type": "TIMESTAMP",
8675
+ "notNull": false,
8676
+ "unique": false
8677
+ },
8678
+ "ends_at": {
8679
+ "type": "TIMESTAMP",
8680
+ "notNull": false,
8681
+ "unique": false
8682
+ },
8683
+ "notes": {
8684
+ "type": "TEXT",
8685
+ "notNull": false,
8686
+ "unique": false
6945
8687
  }
6946
8688
  },
6947
8689
  "indexes": [
6948
8690
  {
6949
8691
  "name": "support_availability_windows_slug_context_idx",
6950
8692
  "columns": [
8693
+ "tenant_id",
6951
8694
  "slug",
6952
8695
  "context"
6953
8696
  ],
6954
- "unique": true
8697
+ "unique": true,
8698
+ "nullsNotDistinct": true
6955
8699
  },
6956
8700
  {
6957
- "name": "support_availability_windows_created_at_idx",
8701
+ "name": "support_availability_windows_tenant_id_created_at_idx",
6958
8702
  "columns": [
8703
+ "tenant_id",
6959
8704
  "created_at"
6960
8705
  ]
8706
+ },
8707
+ {
8708
+ "name": "support_availability_windows_specialist_id_idx",
8709
+ "columns": [
8710
+ "specialist_id"
8711
+ ]
6961
8712
  }
6962
8713
  ],
6963
- "version": "acd97b79"
8714
+ "version": "2f0cafe3"
6964
8715
  }
6965
8716
  },
6966
8717
  "@happyvertical/smrt-support:SupportWorkLink": {
@@ -7196,7 +8947,8 @@
7196
8947
  "target_type",
7197
8948
  "target_id"
7198
8949
  ],
7199
- "unique": true
8950
+ "unique": true,
8951
+ "nullsNotDistinct": true
7200
8952
  },
7201
8953
  {
7202
8954
  "name": "support_work_links_slug_context_idx",
@@ -7249,7 +9001,7 @@
7249
9001
  "collectionExportName": "SupportWorkLinkCollectionCollection",
7250
9002
  "schema": {
7251
9003
  "tableName": "support_work_links",
7252
- "ddl": "CREATE TABLE IF NOT EXISTS \"support_work_links\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp\n);",
9004
+ "ddl": "CREATE TABLE IF NOT EXISTS \"support_work_links\" (\n \"id\" UUID PRIMARY KEY NOT NULL,\n \"slug\" TEXT NOT NULL,\n \"context\" TEXT NOT NULL DEFAULT '',\n \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n \"tenant_id\" UUID,\n \"case_id\" UUID NOT NULL,\n \"link_kind\" TEXT,\n \"target_type\" TEXT,\n \"target_id\" TEXT,\n \"target_label\" TEXT,\n \"external_url\" TEXT,\n \"status\" TEXT,\n \"last_status_at\" TIMESTAMP,\n \"metadata\" TEXT\n);",
7253
9005
  "columns": {
7254
9006
  "id": {
7255
9007
  "type": "UUID",
@@ -7275,25 +9027,93 @@
7275
9027
  "type": "TIMESTAMP",
7276
9028
  "notNull": true,
7277
9029
  "default": "current_timestamp"
9030
+ },
9031
+ "tenant_id": {
9032
+ "type": "UUID",
9033
+ "referenceKind": "tenantId",
9034
+ "notNull": false,
9035
+ "unique": false
9036
+ },
9037
+ "case_id": {
9038
+ "type": "UUID",
9039
+ "referenceKind": "foreignKey",
9040
+ "notNull": true,
9041
+ "unique": false,
9042
+ "foreignKey": {
9043
+ "table": "support_cases",
9044
+ "column": "id",
9045
+ "onDelete": "CASCADE",
9046
+ "onUpdate": "CASCADE"
9047
+ }
9048
+ },
9049
+ "link_kind": {
9050
+ "type": "TEXT",
9051
+ "notNull": false,
9052
+ "unique": false
9053
+ },
9054
+ "target_type": {
9055
+ "type": "TEXT",
9056
+ "notNull": false,
9057
+ "unique": false
9058
+ },
9059
+ "target_id": {
9060
+ "type": "TEXT",
9061
+ "notNull": false,
9062
+ "unique": false
9063
+ },
9064
+ "target_label": {
9065
+ "type": "TEXT",
9066
+ "notNull": false,
9067
+ "unique": false
9068
+ },
9069
+ "external_url": {
9070
+ "type": "TEXT",
9071
+ "notNull": false,
9072
+ "unique": false
9073
+ },
9074
+ "status": {
9075
+ "type": "TEXT",
9076
+ "notNull": false,
9077
+ "unique": false
9078
+ },
9079
+ "last_status_at": {
9080
+ "type": "TIMESTAMP",
9081
+ "notNull": false,
9082
+ "unique": false
9083
+ },
9084
+ "metadata": {
9085
+ "type": "TEXT",
9086
+ "notNull": false,
9087
+ "unique": false
7278
9088
  }
7279
9089
  },
7280
9090
  "indexes": [
9091
+ {
9092
+ "name": "support_work_links_case_id_target_type_idx",
9093
+ "columns": [
9094
+ "case_id",
9095
+ "target_type",
9096
+ "target_id"
9097
+ ],
9098
+ "unique": true,
9099
+ "nullsNotDistinct": true
9100
+ },
7281
9101
  {
7282
9102
  "name": "support_work_links_slug_context_idx",
7283
9103
  "columns": [
7284
9104
  "slug",
7285
9105
  "context"
7286
- ],
7287
- "unique": true
9106
+ ]
7288
9107
  },
7289
9108
  {
7290
- "name": "support_work_links_created_at_idx",
9109
+ "name": "support_work_links_tenant_id_created_at_idx",
7291
9110
  "columns": [
9111
+ "tenant_id",
7292
9112
  "created_at"
7293
9113
  ]
7294
9114
  }
7295
9115
  ],
7296
- "version": "d1147c3e"
9116
+ "version": "c9e0e8f5"
7297
9117
  }
7298
9118
  }
7299
9119
  },