@cxtms/cx-schema 1.1.0 → 1.1.1

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.
Files changed (29) hide show
  1. package/.claude/skills/cx-core/SKILL.md +93 -0
  2. package/.claude/skills/cx-core/ref-entity-accounting.md +173 -0
  3. package/.claude/skills/cx-core/ref-entity-commodity.md +205 -0
  4. package/.claude/skills/cx-core/ref-entity-contact.md +153 -0
  5. package/.claude/skills/cx-core/ref-entity-geography.md +119 -0
  6. package/.claude/skills/cx-core/ref-entity-job.md +77 -0
  7. package/.claude/skills/cx-core/ref-entity-order-sub.md +140 -0
  8. package/.claude/skills/cx-core/ref-entity-order.md +168 -0
  9. package/.claude/skills/cx-core/ref-entity-rate.md +174 -0
  10. package/.claude/skills/cx-core/ref-entity-shared.md +147 -0
  11. package/.claude/skills/cx-core/ref-entity-warehouse.md +110 -0
  12. package/.claude/skills/cx-module/SKILL.md +402 -0
  13. package/.claude/skills/cx-module/ref-components-data.md +286 -0
  14. package/.claude/skills/cx-module/ref-components-display.md +394 -0
  15. package/.claude/skills/cx-module/ref-components-forms.md +362 -0
  16. package/.claude/skills/cx-module/ref-components-interactive.md +306 -0
  17. package/.claude/skills/cx-module/ref-components-layout.md +295 -0
  18. package/.claude/skills/cx-module/ref-components-specialized.md +427 -0
  19. package/.claude/skills/cx-workflow/SKILL.md +330 -0
  20. package/.claude/skills/cx-workflow/ref-accounting.md +66 -0
  21. package/.claude/skills/cx-workflow/ref-communication.md +161 -0
  22. package/.claude/skills/cx-workflow/ref-entity.md +162 -0
  23. package/.claude/skills/cx-workflow/ref-expressions.md +239 -0
  24. package/.claude/skills/cx-workflow/ref-filetransfer.md +80 -0
  25. package/.claude/skills/cx-workflow/ref-flow.md +180 -0
  26. package/.claude/skills/cx-workflow/ref-other.md +120 -0
  27. package/.claude/skills/cx-workflow/ref-query.md +85 -0
  28. package/.claude/skills/cx-workflow/ref-utilities.md +171 -0
  29. package/package.json +3 -2
@@ -0,0 +1,119 @@
1
+ # Geography & Lookup Entity Reference
2
+
3
+ Country, State, City, Port, Vessel, CustomCode, ModeOfTransportation.
4
+
5
+ ## Country
6
+
7
+ Composite key: `organizationId` + `countryCode`.
8
+
9
+ | Field | Type | Notes |
10
+ |-------|------|-------|
11
+ | `countryCode` | `string` | PK part (ISO code) |
12
+ | `organizationId` | `int` | PK part |
13
+ | `name` | `string` | |
14
+ | `customValues` | `Dictionary` | jsonb |
15
+
16
+ **Collections:** `states`
17
+
18
+ ---
19
+
20
+ ## State
21
+
22
+ Composite key: `organizationId` + `countryCode` + `stateCode`.
23
+
24
+ | Field | Type | Notes |
25
+ |-------|------|-------|
26
+ | `stateCode` | `string` | PK part |
27
+ | `countryCode` | `string` | PK part, FK to Country |
28
+ | `organizationId` | `int` | PK part |
29
+ | `name` | `string` | |
30
+ | `customValues` | `Dictionary` | jsonb |
31
+
32
+ **Navigation:** `country`
33
+
34
+ ---
35
+
36
+ ## City
37
+
38
+ | Field | Type | Notes |
39
+ |-------|------|-------|
40
+ | `cityId` | `int` | PK |
41
+ | `organizationId` | `int` | |
42
+ | `cityName` | `string` | |
43
+ | `stateCode` | `string` | FK to State |
44
+ | `countryCode` | `string` | FK to Country |
45
+ | `longitude` | `double?` | From Location.X (GraphQL) |
46
+ | `latitude` | `double?` | From Location.Y (GraphQL) |
47
+ | `customValues` | `Dictionary` | jsonb |
48
+
49
+ **Navigation:** `state`, `country`
50
+
51
+ ---
52
+
53
+ ## Port
54
+
55
+ String-based PK (e.g., UN/LOCODE).
56
+
57
+ | Field | Type | Notes |
58
+ |-------|------|-------|
59
+ | `portId` | `string` | PK |
60
+ | `organizationId` | `int` | |
61
+ | `name` | `string` | |
62
+ | `countryCode` | `string` | FK to Country |
63
+ | `stateCode` | `string?` | FK to State |
64
+ | `isAir` | `bool` | Mode flags |
65
+ | `isMariTime` | `bool` | |
66
+ | `isRoad` | `bool` | |
67
+ | `isRail` | `bool` | |
68
+ | `isMail` | `bool` | |
69
+ | `isBorderCrossingPoint` | `bool` | |
70
+ | `isMyCompany` | `bool` | |
71
+ | `portRemarks` | `string?` | |
72
+ | `customValues` | `Dictionary` | jsonb |
73
+
74
+ **Navigation:** `country`, `state`
75
+
76
+ ---
77
+
78
+ ## Vessel
79
+
80
+ | Field | Type | Notes |
81
+ |-------|------|-------|
82
+ | `vesselId` | `int` | PK |
83
+ | `organizationId` | `int` | |
84
+ | `name` | `string` | |
85
+ | `vesselCode` | `string?` | |
86
+ | `carrierId` | `int?` | FK to Contact (carrier) |
87
+ | `countryCode` | `string?` | FK to Country (flag state) |
88
+
89
+ **Navigation:** `carrier`, `country`. No customValues.
90
+
91
+ ---
92
+
93
+ ## CustomCode
94
+
95
+ Organization-specific lookup codes (Schedule D, Schedule K, etc.).
96
+
97
+ | Field | Type | Notes |
98
+ |-------|------|-------|
99
+ | `id` | `int` | PK |
100
+ | `organizationId` | `int` | |
101
+ | `code` | `string` | |
102
+ | `description` | `string` | |
103
+ | `isCommonlyUsed` | `bool` | |
104
+ | `codeType` | `CustomCodeTypes` enum | ScheduleD, ScheduleK |
105
+
106
+ No customValues.
107
+
108
+ ---
109
+
110
+ ## ModeOfTransportation
111
+
112
+ | Field | Type | Notes |
113
+ |-------|------|-------|
114
+ | `modeOfTransportationId` | `int` | PK |
115
+ | `organizationId` | `int` | |
116
+ | `description` | `string` | e.g., "Air", "Ocean", "Ground" |
117
+ | `customValues` | `Dictionary` | jsonb |
118
+
119
+ Referenced by Rate, Lane, Discount, and Order (via `customValues.modeOfTransportationId`).
@@ -0,0 +1,77 @@
1
+ # Job Entity Field Reference
2
+
3
+ Job groups related orders and accounting transactions.
4
+
5
+ ## Job
6
+
7
+ ### Fields
8
+
9
+ | Field | Type | Notes |
10
+ |-------|------|-------|
11
+ | `jobId` | `Guid` | PK (UUID) |
12
+ | `organizationId` | `int` | Tenant scope |
13
+ | `jobNumber` | `string` | Business-facing number |
14
+ | `description` | `string?` | |
15
+ | `isDraft` | `bool` | |
16
+ | `customerId` | `int?` | FK to Contact |
17
+ | `divisionId` | `int?` | FK to Division |
18
+ | `employeeId` | `int?` | FK to Contact |
19
+ | `jobStatusId` | `int?` | FK to JobStatus |
20
+ | `customValues` | `Dictionary` | jsonb |
21
+
22
+ ### Navigation
23
+
24
+ | Field | Type |
25
+ |-------|------|
26
+ | `customer` | `Contact?` |
27
+ | `division` | `Division?` |
28
+ | `employee` | `Contact?` |
29
+ | `jobStatus` | `JobStatus?` |
30
+
31
+ ### Collections
32
+
33
+ | Field | Type | Notes |
34
+ |-------|------|-------|
35
+ | `orders` | `[Order]` | Via JobOrder join |
36
+ | `accountingTransactions` | `[AccountingTransaction]` | Via JobAccountingTransaction join |
37
+ | `commodities` | `[Commodity]` | Direct FK |
38
+
39
+ ### GraphQL Computed
40
+
41
+ - `getJobOrders(filter)` — orders via JobOrder join
42
+
43
+ ---
44
+
45
+ ## JobOrder (Join Entity)
46
+
47
+ | Field | Type | Notes |
48
+ |-------|------|-------|
49
+ | `jobId` | `Guid` | FK to Job |
50
+ | `orderId` | `int` | FK to Order |
51
+
52
+ No customValues. No audit fields (uses BaseEntity, not AuditableEntity).
53
+
54
+ ---
55
+
56
+ ## JobStatus
57
+
58
+ | Field | Type | Notes |
59
+ |-------|------|-------|
60
+ | `jobStatusId` | `int` | PK |
61
+ | `organizationId` | `int` | |
62
+ | `jobStatusName` | `string` | |
63
+ | `priority` | `int` | |
64
+ | `statusStage` | `StatusStage` enum | Pending=1, InProgress, Completed |
65
+ | `customValues` | `Dictionary` | jsonb |
66
+
67
+ ---
68
+
69
+ ## StatusStage Enum
70
+
71
+ Used by JobStatus, OrderStatus, ContactStatus:
72
+
73
+ | Value | Int |
74
+ |-------|-----|
75
+ | `Pending` | 1 |
76
+ | `InProgress` | 2 |
77
+ | `Completed` | 3 |
@@ -0,0 +1,140 @@
1
+ # Order Sub-Entity Field Reference
2
+
3
+ Entities associated with orders: OrderEntity (parties), TrackingEvent, LinkedOrder, OrderDocument.
4
+
5
+ ## OrderEntity
6
+
7
+ Represents a party role (Shipper, Consignee, Carrier, etc.) on an order.
8
+
9
+ ### Fields
10
+
11
+ | Field | Type | Notes |
12
+ |-------|------|-------|
13
+ | `orderEntityId` | `int` | PK |
14
+ | `orderId` | `int` | FK to Order |
15
+ | `contactId` | `int?` | FK to Contact |
16
+ | `contactAddressId` | `int?` | FK to ContactAddress |
17
+ | `nonContactName` | `string?` | Name when no contact linked |
18
+ | `entityType` | `EntityTypes` enum | Shipper, Consignee, Carrier, etc. |
19
+ | `orderEntitySequence` | `int` | Sort order |
20
+ | `isDeleted` | `bool?` | Soft delete |
21
+ | `customValues` | `Dictionary` | jsonb |
22
+
23
+ ### Navigation
24
+
25
+ | Field | Type |
26
+ |-------|------|
27
+ | `contact` | `Contact?` |
28
+ | `contactAddress` | `ContactAddress?` |
29
+
30
+ ### GraphQL Computed
31
+
32
+ - `contactName` — mapped from `contact.name`
33
+ - `attachments` — filterable collection
34
+ - `getOrderEntityAttachments(idPropertyName, filter, orderBy, search)` — resolver
35
+
36
+ ### EntityTypes Enum
37
+
38
+ Shipper=0, Consignee=1, Carrier=2, Vendor=3, UltimateConsignee=4, NotifyParty=5, Intermediate=6, ForwardingAgent=7, DestinationAgent=8, PickupFrom=9, DeliverTo=10, DeliveryCarrier=11, ReceivedBy=12, USPPI=13
39
+
40
+ ---
41
+
42
+ ## TrackingEvent
43
+
44
+ Milestone/tracking event on an order or commodity.
45
+
46
+ ### Fields
47
+
48
+ | Field | Type | Notes |
49
+ |-------|------|-------|
50
+ | `trackingEventId` | `int` | PK |
51
+ | `eventDefinitionId` | `int` | FK to EventDefinition |
52
+ | `eventDate` | `DateTime?` | When the event occurred |
53
+ | `description` | `string?` | |
54
+ | `location` | `string?` | |
55
+ | `isInactive` | `bool` | |
56
+ | `includeInTracking` | `bool` | Show in tracking UI |
57
+ | `sendEmail` | `bool` | Trigger email notification |
58
+ | `customValues` | `Dictionary` | jsonb |
59
+
60
+ ### Navigation
61
+
62
+ | Field | Type |
63
+ |-------|------|
64
+ | `eventDefinition` | `EventDefinition` |
65
+
66
+ ---
67
+
68
+ ## EventDefinition
69
+
70
+ Template/type definition for tracking events.
71
+
72
+ ### Fields
73
+
74
+ | Field | Type | Notes |
75
+ |-------|------|-------|
76
+ | `eventDefinitionId` | `int` | PK |
77
+ | `eventName` | `string` | |
78
+ | `description` | `string?` | |
79
+ | `location` | `string?` | Default location |
80
+ | `isInactive` | `bool` | |
81
+ | `includeInTracking` | `bool` | Default for events |
82
+ | `sendEmail` | `bool` | Default for events |
83
+ | `sendEmailDocumentId` | `int?` | FK to DocumentTemplate |
84
+ | `isAutomaticCreate` | `bool` | Auto-create on triggers |
85
+ | `triggerEventName` | `string?` | Trigger config |
86
+ | `triggerEntityName` | `string?` | |
87
+ | `triggerConditionFields` | `string?` | |
88
+ | `customValues` | `Dictionary` | jsonb |
89
+
90
+ ---
91
+
92
+ ## LinkedOrder
93
+
94
+ Links between orders (source → target).
95
+
96
+ ### Fields
97
+
98
+ | Field | Type | Notes |
99
+ |-------|------|-------|
100
+ | `sourceOrderId` | `int` | FK to Order (source) |
101
+ | `targetOrderId` | `int` | FK to Order (target) |
102
+ | `isDeleted` | `bool` | Soft delete |
103
+ | `customValues` | `Dictionary` | jsonb |
104
+
105
+ ### Navigation
106
+
107
+ | Field | Type |
108
+ |-------|------|
109
+ | `sourceOrder` | `Order` |
110
+ | `targetOrder` | `Order` |
111
+
112
+ ---
113
+
114
+ ## OrderDocument
115
+
116
+ Document template linked to an order for generation.
117
+
118
+ ### Fields
119
+
120
+ | Field | Type | Notes |
121
+ |-------|------|-------|
122
+ | `orderDocumentId` | `int` | PK |
123
+ | `orderId` | `int` | FK to Order |
124
+ | `documentTemplateId` | `int?` | FK to DocumentTemplate |
125
+ | `workflowId` | `Guid?` | FK to Workflow (for generation) |
126
+ | `lastGeneratedFile` | `string?` | File path/key |
127
+ | `lastGeneratedTime` | `DateTime?` | |
128
+ | `regenerateOnOrderChange` | `bool` | Auto-regenerate |
129
+ | `metadata` | `Dictionary` | jsonb — auto-populated keys: `orderId`, `orderPickupId`, `orderDeliveryId`, `thirdPartyContactId`, `carrierId` |
130
+
131
+ ### Navigation
132
+
133
+ | Field | Type |
134
+ |-------|------|
135
+ | `order` | `Order` |
136
+ | `documentTemplate` | `DocumentTemplate?` |
137
+
138
+ ### GraphQL Computed
139
+
140
+ - `getLinkToDocument(expiresInDays)` — returns signed URL
@@ -0,0 +1,168 @@
1
+ # Order Entity Field Reference
2
+
3
+ Field names as used in workflow expressions: `{{ entity.orderId }}`, `{{ entity.customValues.myField }}`.
4
+
5
+ ## Scalar Fields
6
+
7
+ | Field | Type | Notes |
8
+ |-------|------|-------|
9
+ | `orderId` | `int` | Primary key |
10
+ | `organizationId` | `int` | Tenant scope |
11
+ | `orderNumber` | `string` | Business-facing number |
12
+ | `trackingNumber` | `string?` | |
13
+ | `orderType` | `OrderTypes` enum | See enum below |
14
+ | `isDraft` | `bool` | Draft orders excluded from default queries |
15
+ | `orderStatusId` | `int` | FK to OrderStatus |
16
+ | `lastOrderStatusModified` | `DateTime?` | Auto-set on status change |
17
+ | `entityTypeId` | `int?` | FK to EntityType |
18
+ | `divisionId` | `int` | FK to Division |
19
+ | `equipmentTypeId` | `int?` | FK to EquipmentType |
20
+ | `billToContactId` | `int?` | FK to Contact |
21
+ | `employeeContactId` | `int?` | FK to Contact |
22
+ | `salespersonContactId` | `int?` | FK to Contact |
23
+ | `created` | `DateTime` | |
24
+ | `createdBy` | `string` | User ID |
25
+ | `lastModified` | `DateTime` | |
26
+ | `lastModifiedBy` | `string` | User ID |
27
+
28
+ ## Navigation Properties
29
+
30
+ | Field | Type | Notes |
31
+ |-------|------|-------|
32
+ | `orderStatus` | `OrderStatus` | `.statusName`, `.statusStage` |
33
+ | `division` | `Division` | `.name` |
34
+ | `equipmentType` | `EquipmentType` | |
35
+ | `billToContact` | `Contact` | Full contact object |
36
+ | `employeeContact` | `Contact` | |
37
+ | `salespersonContact` | `Contact` | |
38
+ | `organization` | `Organization` | |
39
+ | `entityType` | `EntityType` | |
40
+ | `createdUser` | `User` | `.firstName`, `.lastName`, `.email` |
41
+ | `updatedUser` | `User` | |
42
+
43
+ ## Collection Properties
44
+
45
+ | Field | Type | Notes |
46
+ |-------|------|-------|
47
+ | `orderEntities` | `[OrderEntity]` | Shipper, Consignee, Carrier, etc. (by `entityType`) |
48
+ | `charges` | `[Charge]` | Direct charges |
49
+ | `orderCommodities` | `[OrderCommodity]` | Join to commodities (has own `customValues`) |
50
+ | `trackingEvents` | `[TrackingEvent]` | Milestones |
51
+ | `orderDocuments` | `[OrderDocument]` | |
52
+ | `jobs` | `[Job]` | |
53
+ | `jobOrders` | `[JobOrder]` | |
54
+ | `orderTags` | `[OrderTag]` | |
55
+ | `orderCarriers` | `[OrderCarrier]` | |
56
+ | `allTags` | `[OrderAllTagsView]` | View: all tags including from commodities |
57
+ | `allRelatedOrders` | `[OrderRelatedOrdersView]` | Orders sharing commodities |
58
+ | `outgoingLinks` | `[LinkedOrder]` | |
59
+ | `incomingLinks` | `[LinkedOrder]` | |
60
+
61
+ ## Pre-filtered OrderEntity Collections (GraphQL)
62
+
63
+ These are virtual fields that filter `orderEntities` by type:
64
+
65
+ | Field | EntityType |
66
+ |-------|------------|
67
+ | `orderEntityCarriers` | Carrier |
68
+ | `orderEntityVendors` | Vendor |
69
+ | `orderEntityPickups` | Shipper |
70
+ | `orderEntityDeliveries` | Consignee |
71
+ | `orderEntityDeliveryCarriers` | DeliveryCarrier |
72
+ | `orderEntityDeliverTo` | DeliverTo |
73
+ | `orderEntityPickupFrom` | PickupFrom |
74
+ | `orderEntityDestinationAgent` | DestinationAgent |
75
+ | `orderEntityForwardingAgent` | ForwardingAgent |
76
+ | `orderEntityIntermediate` | Intermediate |
77
+ | `orderEntityNotifyParty` | NotifyParty |
78
+ | `orderEntityUltimateConsignee` | UltimateConsignee |
79
+ | `orderEntityReceivedBy` | ReceivedBy |
80
+ | `orderEntityUsppi` | USPPI |
81
+
82
+ ## Computed/Resolved GraphQL Fields
83
+
84
+ | Field | Returns | Notes |
85
+ |-------|---------|-------|
86
+ | `commoditySummary` | `CommoditySummary` | `.totalWeight`, `.totalPieces`, `.totalQuantity`, `.totalVolume` |
87
+ | `accountingSummary` | `AccountingSummary` | |
88
+ | `getContact(idPropertyName)` | `Contact` | Resolve contact from `customValues[idPropertyName]` |
89
+ | `getPort(idPropertyName)` | `Port` | Resolve port from `customValues[idPropertyName]` |
90
+ | `getVessel(idPropertyName)` | `Vessel` | Resolve vessel from `customValues[idPropertyName]` |
91
+ | `getCountry(idPropertyName)` | `Country` | Resolve country from `customValues[idPropertyName]` |
92
+ | `getRoute(idPropertyName)` | `Route` | Resolve route from `customValues[idPropertyName]` |
93
+ | `getModeOfTransportation(idPropertyName)` | `ModeOfTransportation` | |
94
+ | `getCustomCode(idPropertyName)` | `CustomCode` | |
95
+ | `getRelatedOrderByProperty(idPropertyName)` | `Order` | Resolve related order from `customValues[idPropertyName]` |
96
+ | `getCharge(chargeDescription)` | `Charge` | Single charge by description |
97
+ | `getChargesByChargeType(chargeType)` | `[Charge]` | Charges filtered by type |
98
+ | `getOrderSummary(weightUnit, volumeUnit, dimensionsUnit)` | `OrderSummary` | |
99
+ | `lastTrackingEvent(eventDefinitionName)` | `TrackingEvent` | Most recent |
100
+ | `notesCount(threadFilter)` | `int` | |
101
+ | `changeHistory(startDate, endDate, maxResults)` | `[ChangeHistory]` | Audit trail |
102
+
103
+ ## OrderTypes Enum
104
+
105
+ | Value | Int | Notes |
106
+ |-------|-----|-------|
107
+ | `Order` | 0 | Generic order |
108
+ | `Quote` | 1 | |
109
+ | `WarehouseReceipt` | 2 | Warehouse order |
110
+ | `Purchase` | 3 | Pickup order |
111
+ | `ParcelShipment` | 4 | |
112
+ | `AirShipmentOrder` | 5 | |
113
+ | `OceanShipmentOrder` | 6 | |
114
+ | `CargoMovement` | 7 | |
115
+ | `EntityType` | 8 | Type defined by EntityType |
116
+ | `PickupOrder` | 9 | |
117
+ | `LoadOrder` | 10 | |
118
+ | `BookingOrder` | 11 | |
119
+ | `Freight` | 12 | |
120
+ | `DeliveryOrder` | 13 | |
121
+
122
+ ## EntityTypes Enum (for OrderEntity)
123
+
124
+ | Value | Int | Description |
125
+ |-------|-----|-------------|
126
+ | `Shipper` | 0 | Origin party |
127
+ | `Consignee` | 1 | Destination party |
128
+ | `Carrier` | 2 | Transport provider |
129
+ | `Vendor` | 3 | |
130
+ | `UltimateConsignee` | 4 | |
131
+ | `NotifyParty` | 5 | |
132
+ | `Intermediate` | 6 | |
133
+ | `ForwardingAgent` | 7 | |
134
+ | `DestinationAgent` | 8 | |
135
+ | `PickupFrom` | 9 | |
136
+ | `DeliverTo` | 10 | |
137
+ | `DeliveryCarrier` | 11 | |
138
+ | `ReceivedBy` | 12 | |
139
+ | `USPPI` | 13 | US Principal Party in Interest |
140
+
141
+ ## CustomValues
142
+
143
+ `Dictionary<string, object?>` stored as PostgreSQL `jsonb`. Access in workflows:
144
+
145
+ ```yaml
146
+ # Template expressions
147
+ value: "{{ entity.customValues.myField }}"
148
+ value: "{{ entity.customValues['my-field'] }}"
149
+
150
+ # NCalc conditions
151
+ conditions:
152
+ - expression: "isNullOrEmpty([entity.customValues.myField?]) = false"
153
+
154
+ # Update via Order/Update task
155
+ inputs:
156
+ orderId: "{{ entity.orderId }}"
157
+ order:
158
+ CustomValues.myField: "newValue" # Dot notation (single field)
159
+ customValues: # Bulk update (merge)
160
+ field1: "value1"
161
+ field2: "{{ computed }}"
162
+ ```
163
+
164
+ **Known system customValues keys:**
165
+ - `modeOfTransportationId` / `modeOfTransportationIdDescription` — transport mode
166
+
167
+ **Resolver pattern** — Many GraphQL fields resolve entities from customValues IDs:
168
+ `getContact(idPropertyName)` reads `customValues[idPropertyName]` as a contact ID and returns the full Contact object. Same pattern for ports, vessels, countries, routes, etc.
@@ -0,0 +1,174 @@
1
+ # Rate, Pricing & Accounting Lookup Reference
2
+
3
+ ## Rate
4
+
5
+ Carrier/vendor rates with tariff rules.
6
+
7
+ ### Fields
8
+
9
+ | Field | Type | Notes |
10
+ |-------|------|-------|
11
+ | `rateId` | `int` | PK |
12
+ | `organizationId` | `int` | |
13
+ | `rateNumber` | `string?` | |
14
+ | `rateType` | `RateType` enum | StandardClientRate=0, ClientRate=1, CarrierRate=2, CommissionRate=3 |
15
+ | `carrierId` | `int?` | FK to Contact |
16
+ | `clientId` | `int?` | FK to Contact |
17
+ | `currencyId` | `int?` | FK to Currency |
18
+ | `accountingItemId` | `int?` | FK to AccountingItem |
19
+ | `modeOfTransportationId` | `int?` | FK |
20
+ | `commodityTypeId` | `int?` | FK |
21
+ | `effectiveDate` | `DateTime?` | |
22
+ | `expirationDate` | `DateTime?` | |
23
+ | `contractNumber` | `string?` | |
24
+ | `amendmentNumber` | `string?` | |
25
+ | `transitDaysMin` | `int?` | |
26
+ | `transitDaysMax` | `int?` | |
27
+ | `serviceType` | `ServiceType?` enum | PortToDoor=1, DoorToDoor=2, DoorToPort=3, PortToPort=4 |
28
+ | `frequency` | `Frequency?` enum | Daily=1, Weekly=2, Biweekly=3, Monthly=4, Other=5 |
29
+ | `automaticallyCreateCharge` | `bool` | |
30
+ | `isHazardous` | `bool?` | |
31
+ | `notes` | `string?` | |
32
+ | `tariff` | `TariffOptions` | JSON object (see below) |
33
+ | `routeId` | `int?` | FK to Route |
34
+ | `routeLegId` | `int?` | FK to RouteLeg |
35
+ | `customValues` | `Dictionary` | jsonb |
36
+
37
+ ### Port References (on Rate)
38
+
39
+ | Field | Type |
40
+ |-------|------|
41
+ | `portOfReceiptId` | `string?` → Port |
42
+ | `portOfLoadingId` | `string?` → Port |
43
+ | `portOfUnloadingId` | `string?` → Port |
44
+ | `portOfDeliveryId` | `string?` → Port |
45
+ | `countryOfOriginCode` | `string?` → Country |
46
+ | `countryOfDestinationCode` | `string?` → Country |
47
+
48
+ ### TariffOptions (JSON object)
49
+
50
+ | Field | Type | Notes |
51
+ |-------|------|-------|
52
+ | `baseCharge` | `decimal?` | |
53
+ | `minimum` | `decimal?` | |
54
+ | `maximum` | `decimal?` | |
55
+ | `rateMultiplier` | `decimal?` | |
56
+ | `ratePer` | `decimal?` | |
57
+ | `applyBy` | `ApplyBy?` enum | Pieces, Weight, ChargeableWeight, Volume, Container, Calculated, FlatRate |
58
+ | `unitType` | `Units?` enum | Ft, Vlb, Vkg, M, Lb, Kg |
59
+ | `ratePerType` | `RatePerType?` enum | Unit, Range |
60
+ | `calculatedOf` | `CalculatedOfTypes?` enum | Income, Expense, Profit, IncomeFreight |
61
+ | `percentageOfType` | `PercentageOfType?` enum | Cost, Income, Profit |
62
+ | `minimumChargeableWeight` | `decimal?` | |
63
+ | `minimumWeight` | `decimal?` | |
64
+ | `maximumWeight` | `decimal?` | |
65
+ | `rateData` | `[{rateIndex, rateValue, packageTypeId}]` | |
66
+
67
+ ---
68
+
69
+ ## Lane
70
+
71
+ Shipping lanes linking origin/destination.
72
+
73
+ ### Fields
74
+
75
+ | Field | Type | Notes |
76
+ |-------|------|-------|
77
+ | `id` | `int` | PK |
78
+ | `organizationId` | `int` | |
79
+ | `contactId` | `int` | FK to Contact |
80
+ | `description` | `string?` | |
81
+ | `originPortId` | `string?` | FK to Port |
82
+ | `destinationPortId` | `string?` | FK to Port |
83
+ | `originCityId` | `int?` | FK to City |
84
+ | `destinationCityId` | `int?` | FK to City |
85
+ | `customValues` | `Dictionary` | jsonb |
86
+
87
+ ### Navigation
88
+
89
+ `contact`, `originPort`, `destinationPort`, `originCity`, `destinationCity`, `modeOfTransportations` (M2M)
90
+
91
+ ---
92
+
93
+ ## Discount
94
+
95
+ ### Fields
96
+
97
+ | Field | Type | Notes |
98
+ |-------|------|-------|
99
+ | `discountId` | `int` | PK |
100
+ | `organizationId` | `int` | |
101
+ | `name` | `string?` | |
102
+ | `promoCode` | `string?` | |
103
+ | `description` | `string?` | |
104
+ | `type` | `DiscountType` enum | Percentage=1, FixedAmount=2 |
105
+ | `value` | `decimal` | Percentage or fixed amount |
106
+ | `startDate` | `DateTime` | |
107
+ | `endDate` | `DateTime` | |
108
+ | `isActive` | `bool` | |
109
+ | `usageLimit` | `int?` | Max times discount can be used |
110
+ | `usedCount` | `int` | |
111
+ | `activationLimit` | `int?` | |
112
+ | `activationCount` | `int` | |
113
+ | `minimumChargeAmount` | `decimal?` | |
114
+ | `minimumWeight` | `decimal?` | |
115
+ | `minimumWeightUnit` | `WeightUnit?` | Lb, Kg |
116
+ | `accountingItemId` | `int` | FK |
117
+ | `targetContactTags` | `[string]` | Tag-based targeting |
118
+ | `customValues` | `Dictionary` | jsonb |
119
+
120
+ ### Navigation
121
+
122
+ `carriers` (M2M via ContactDiscount), `transportationModes` (M2M), `destinationCountries` (M2M), `validationWorkflows` (M2M)
123
+
124
+ ---
125
+
126
+ ## AccountingItem
127
+
128
+ Chart of accounts line items.
129
+
130
+ | Field | Type | Notes |
131
+ |-------|------|-------|
132
+ | `accountingItemId` | `int` | PK |
133
+ | `organizationId` | `int` | |
134
+ | `itemCode` | `string?` | |
135
+ | `description` | `string` | |
136
+ | `itemType` | `ItemType` enum | Other=0, Freight=1, Valuation=2, Tax=3, OtherFreight=4, Inventory=5 |
137
+ | `price` | `decimal?` | |
138
+ | `accountId` | `int` | FK to AccountingAccount |
139
+ | `salesTaxId` | `int?` | FK to SalesTax |
140
+ | `tariff` | `TariffOptions?` | Same JSON as Rate |
141
+ | `isInactive` | `bool` | |
142
+ | `customValues` | `Dictionary` | jsonb |
143
+
144
+ ---
145
+
146
+ ## AccountingAccount
147
+
148
+ | Field | Type | Notes |
149
+ |-------|------|-------|
150
+ | `accountId` | `int` | PK |
151
+ | `organizationId` | `int` | |
152
+ | `accountName` | `string` | |
153
+ | `accountNumber` | `string?` | |
154
+ | `accountType` | `AccountType` enum | AccountReceivable=1, AccountPayable=2 |
155
+ | `parentAccountId` | `int?` | Self-referencing FK |
156
+ | `isInactive` | `bool` | |
157
+
158
+ No customValues.
159
+
160
+ ---
161
+
162
+ ## PaymentTerm
163
+
164
+ | Field | Type | Notes |
165
+ |-------|------|-------|
166
+ | `paymentTermId` | `int` | PK |
167
+ | `organizationId` | `int` | |
168
+ | `description` | `string` | |
169
+ | `netDueDays` | `int` | Days until due |
170
+ | `discountPaidWithinDays` | `int?` | Early payment discount window |
171
+ | `discountPercentage` | `int?` | Early payment discount % |
172
+ | `isInactive` | `bool` | |
173
+
174
+ No customValues.