Service - Delivery Method Rate Table: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| (6 intermediate revisions by 2 users not shown) | |||
| Line 6: | Line 6: | ||
https://bitbucket.org/izara-market-products/izara-market-products-delivery-method-rate-table | https://bitbucket.org/izara-market-products/izara-market-products-delivery-method-rate-table | ||
= Schemas = | |||
==ObjectSchemas== | |||
=== rates === | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
"objectType": "rates", | |||
"canDelete": false, | |||
"storageResources": { | |||
"graph": { | |||
"storageType": "graph", | |||
"graphServerTag": "GraphHandler" | |||
} | |||
}, | |||
"fieldNames": { | |||
"ratesId": { | |||
"type": "string", | |||
"randomOnCreate": true, | |||
"optionalOnCreate": false, | |||
"requiredOnCreate": false, | |||
"canUpdate": false, | |||
"validation": { | |||
"pattern": { | |||
"type": "string", | |||
"pattern": "^[a-zA-Z0-9_-]+$", | |||
"minLength": 1 | |||
} | |||
}, | |||
"storageResourceTags": [ | |||
"graph" | |||
] | |||
}, | |||
"upToValue": { | |||
"type": "number", | |||
"randomOnCreate": false, | |||
"optionalOnCreate": false, | |||
"requiredOnCreate": true, | |||
"canUpdate": false, | |||
"validation": { | |||
}, | |||
"storageResourceTags": [ | |||
"graph" | |||
] | |||
}, | |||
"rate": { | |||
"type": "number", | |||
"randomOnCreate": false, | |||
"optionalOnCreate": true, | |||
"requiredOnCreate": false, | |||
"canUpdate": false, | |||
"validation": { | |||
}, | |||
"storageResourceTags": [ | |||
"graph" | |||
] | |||
} | |||
}, | |||
"identifiers": [ | |||
{ | |||
"type": "identifier", | |||
"fieldName": "ratesId" | |||
} | |||
], | |||
"generatedBy": "userGenerated", | |||
"compositeKeyDeliminator": "_" | |||
} | |||
</syntaxhighlight> | |||
=== rateTable === | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
"objectType": "rateTable", | |||
"canDelete": false, | |||
"storageResources": { | |||
"graph": { | |||
"storageType": "graph", | |||
"graphServerTag": "GraphHandler" | |||
} | |||
}, | |||
"fieldNames": { | |||
"rateTableId": { | |||
"type": "string", | |||
"randomOnCreate": true, | |||
"optionalOnCreate": false, | |||
"requiredOnCreate": false, | |||
"canUpdate": false, | |||
"validation": { | |||
"pattern": { | |||
"type": "string", | |||
"pattern": "^[a-zA-Z0-9_-]+$", | |||
"minLength": 1 | |||
} | |||
}, | |||
"storageResourceTags": [ | |||
"graph" | |||
] | |||
} | |||
}, | |||
"identifiers": [ | |||
{ | |||
"type": "identifier", | |||
"fieldName": "rateTableId" | |||
} | |||
], | |||
"generatedBy": "userGenerated", | |||
"compositeKeyDeliminator": "_" | |||
} | |||
</syntaxhighlight> | |||
==RelationshipSchemas== | |||
=== hasRates === | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
"relationshipServiceTag": "DeliveryMethodRAT", | |||
"fieldNames": { | |||
"originTimeStamp": { | |||
"type": "number", | |||
"requiredOnCreate": false, | |||
"canUpdate": true, | |||
"validation": { | |||
}, | |||
"optionalOnCreate": false | |||
}, | |||
}, | |||
"storageResources": { | |||
"graph": { | |||
"storageType": "graph", | |||
"graphServerTag": "GraphHandler" | |||
} | |||
}, | |||
"links": [ | |||
{ | |||
"storageResourceTags": [ | |||
"graph" | |||
], | |||
"from": { | |||
"objType": { | |||
"serviceTag": "DeliveryMethodRAT", | |||
"objectType": "rateTable" | |||
}, | |||
"linkType": "many", | |||
"handler": true, | |||
"requiredOnCreate": false | |||
}, | |||
"to": { | |||
"objType": { | |||
"serviceTag": "DeliveryMethodRAT", | |||
"objectType": "rates" | |||
}, | |||
"linkType": "one", | |||
"handler": true, | |||
"requiredOnCreate": false | |||
}, | |||
"canDelete": false | |||
} | |||
], | |||
"canMove": false | |||
} | |||
</syntaxhighlight> | |||
=== disableRates === | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
"relationshipServiceTag": "DeliveryMethodRAT", | |||
"fieldNames": { | |||
"originTimeStamp": { | |||
"type": "number", | |||
"requiredOnCreate": false, | |||
"canUpdate": true, | |||
"validation": { | |||
}, | |||
"optionalOnCreate": false | |||
}, | |||
}, | |||
"storageResources": { | |||
"graph": { | |||
"storageType": "graph", | |||
"graphServerTag": "GraphHandler" | |||
} | |||
}, | |||
"links": [ | |||
{ | |||
"storageResourceTags": [ | |||
"graph" | |||
], | |||
"from": { | |||
"objType": { | |||
"serviceTag": "DeliveryMethodRAT", | |||
"objectType": "rateTable" | |||
}, | |||
"linkType": "many", | |||
"handler": true, | |||
"requiredOnCreate": false | |||
}, | |||
"to": { | |||
"objType": { | |||
"serviceTag": "DeliveryMethodRAT", | |||
"objectType": "rates" | |||
}, | |||
"linkType": "one", | |||
"handler": true, | |||
"requiredOnCreate": false | |||
}, | |||
"canDelete": false | |||
} | |||
], | |||
"canMove": false | |||
} | |||
</syntaxhighlight> | |||
=== deliversToLocationNode === | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
"relationshipServiceTag": "DeliveryMethodRAT", | |||
"fieldNames": { | |||
"originTimeStamp": { | |||
"type": "number", | |||
"requiredOnCreate": false, | |||
"canUpdate": true, | |||
"validation": { | |||
}, | |||
"optionalOnCreate": false | |||
}, | |||
}, | |||
"storageResources": { | |||
"graph": { | |||
"storageType": "graph", | |||
"graphServerTag": "GraphHandler" | |||
} | |||
}, | |||
"links": [ | |||
{ | |||
"storageResourceTags": [ | |||
"graph" | |||
], | |||
"from": { | |||
"objType": { | |||
"serviceTag": "DeliveryMethodRAT", | |||
"objectType": "rateTable" | |||
}, | |||
"linkType": "many", | |||
"handler": true, | |||
"requiredOnCreate": false | |||
}, | |||
"to": { | |||
"objType": { | |||
"serviceTag": "Locations", | |||
"objectType": "locationNode" | |||
}, | |||
"linkType": "one", | |||
"handler": true, | |||
"requiredOnCreate": false | |||
}, | |||
"canDelete": false | |||
} | |||
], | |||
"canMove": false | |||
} | |||
</syntaxhighlight> | |||
=== disabledDeliversTolocationNode === | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
"relationshipServiceTag": "DeliveryMethodRAT", | |||
"fieldNames": { | |||
"originTimeStamp": { | |||
"type": "number", | |||
"requiredOnCreate": false, | |||
"canUpdate": true, | |||
"validation": { | |||
}, | |||
"optionalOnCreate": false | |||
}, | |||
}, | |||
"storageResources": { | |||
"graph": { | |||
"storageType": "graph", | |||
"graphServerTag": "GraphHandler" | |||
} | |||
}, | |||
"links": [ | |||
{ | |||
"storageResourceTags": [ | |||
"graph" | |||
], | |||
"from": { | |||
"objType": { | |||
"serviceTag": "DeliveryMethodRAT", | |||
"objectType": "rateTable" | |||
}, | |||
"linkType": "many", | |||
"handler": true, | |||
"requiredOnCreate": false | |||
}, | |||
"to": { | |||
"objType": { | |||
"serviceTag": "Locations", | |||
"objectType": "locationNode" | |||
}, | |||
"linkType": "one", | |||
"handler": true, | |||
"requiredOnCreate": false | |||
}, | |||
"canDelete": false | |||
} | |||
], | |||
"canMove": false | |||
} | |||
</syntaxhighlight> | |||
= DynamoDB tables = | = DynamoDB tables = | ||
| Line 20: | Line 341: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== LogicalResultsMain == | |||
[[Standard LogicalResults Per Service|LogicalResultsMain]] | |||
== LogicalResultsData == | |||
[[Standard LogicalResults Per Service|LogicalResultsData]] | |||
== LogicalAwaitingStep == | |||
[[Standard LogicalResults Per Service|LogicalAwaitingStep]] | |||
= Graph database = | = Graph database = | ||
| Line 42: | Line 372: | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Versioned data === | === Versioned data === | ||
| Line 74: | Line 402: | ||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
relationshipType: "{ | relationshipType: "{DeliveryMethodStandardLib.createHasDeliveryMethodRateTableGraphRelationshipType()}", // "deliversTo_locationNode" | ||
schema: { | |||
elementCanBeRemoved: true, | |||
allPropertiesImmutable: true, | |||
restrictProperties: true, | |||
properties: { | |||
originTimestamp: //timestamp the request to create/change this relationship was sent | |||
}, | |||
} | |||
} | |||
</syntaxhighlight> | |||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
relationshipType: "{DeliveryMethodStandardLib.createDisabledDeliveryMethodRateTableGraphRelationshipType()}", // "disabledDeliversTo_locationNode" | |||
schema: { | schema: { | ||
elementCanBeRemoved: | elementCanBeRemoved: true, | ||
allPropertiesImmutable: true, | allPropertiesImmutable: true, | ||
restrictProperties: true, | restrictProperties: true, | ||
properties: { | properties: { | ||
originTimestamp: //timestamp the request to create/change this relationship was sent | originTimestamp: //timestamp the request to create/change this relationship was sent | ||
}, | }, | ||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* | |||
* enable/disable links to locationNodes | |||
* after a locationNode relationship is added to a RateTable it always remains as either one of the above relationships, in order to maintain history of changes | |||
<syntaxhighlight lang="JavaScript"> | <syntaxhighlight lang="JavaScript"> | ||
{ | { | ||
relationshipType: " | relationshipType: "adjustDeliversTo_performedBy" | ||
schema: { | schema: { | ||
elementCanBeRemoved: false, | elementCanBeRemoved: false, | ||
| Line 97: | Line 439: | ||
properties: { | properties: { | ||
originTimestamp: //timestamp the request to create/change this relationship was sent | originTimestamp: //timestamp the request to create/change this relationship was sent | ||
locationNodeId: // | locationNodeId: | ||
action: // "added"|"enabled"|"disabled" | |||
}, | }, | ||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
* | |||
* adds a relationship record between rateTable node and user whenever delivers to relationship added or removed | |||
= Data structure notes = | = Data structure notes = | ||
| Line 118: | Line 462: | ||
{ | { | ||
type: "logical", | type: "logical", | ||
logicalTag: " | logicalTag: "deliverToLocationId", | ||
comparison: "equals", | comparison: "equals", | ||
value: "xx" | value: "xx" | ||
}, | }, | ||
{ | |||
// finds all rateTables that has at >=1 has_deliveryMethodRateTable incomming relationship from give sellOfferPlanDeliveryMethodLinkId | |||
type: "logical", | |||
logicalTag: "activeSellOfferPlanDeliveryMethodLinkId", | |||
comparison: "equals", | |||
value: "xx" | |||
}, | |||
{ | { | ||
// finds all rateTables that has at >=1 has_deliveryMethodRateTable incomming relationship | // finds all rateTables that has at >=1 has_deliveryMethodRateTable incomming relationship | ||
Latest revision as of 08:47, 13 January 2026
Overview
Manages delivery rate tables for delivery methods (possible other objects). Rate tables combine set rates at a certain value with increment settings to easily maintain rate table calculations.
Repository
https://bitbucket.org/izara-market-products/izara-market-products-delivery-method-rate-table
Schemas
ObjectSchemas
rates
{
"objectType": "rates",
"canDelete": false,
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"fieldNames": {
"ratesId": {
"type": "string",
"randomOnCreate": true,
"optionalOnCreate": false,
"requiredOnCreate": false,
"canUpdate": false,
"validation": {
"pattern": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]+$",
"minLength": 1
}
},
"storageResourceTags": [
"graph"
]
},
"upToValue": {
"type": "number",
"randomOnCreate": false,
"optionalOnCreate": false,
"requiredOnCreate": true,
"canUpdate": false,
"validation": {
},
"storageResourceTags": [
"graph"
]
},
"rate": {
"type": "number",
"randomOnCreate": false,
"optionalOnCreate": true,
"requiredOnCreate": false,
"canUpdate": false,
"validation": {
},
"storageResourceTags": [
"graph"
]
}
},
"identifiers": [
{
"type": "identifier",
"fieldName": "ratesId"
}
],
"generatedBy": "userGenerated",
"compositeKeyDeliminator": "_"
}
rateTable
{
"objectType": "rateTable",
"canDelete": false,
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"fieldNames": {
"rateTableId": {
"type": "string",
"randomOnCreate": true,
"optionalOnCreate": false,
"requiredOnCreate": false,
"canUpdate": false,
"validation": {
"pattern": {
"type": "string",
"pattern": "^[a-zA-Z0-9_-]+$",
"minLength": 1
}
},
"storageResourceTags": [
"graph"
]
}
},
"identifiers": [
{
"type": "identifier",
"fieldName": "rateTableId"
}
],
"generatedBy": "userGenerated",
"compositeKeyDeliminator": "_"
}
RelationshipSchemas
hasRates
{
"relationshipServiceTag": "DeliveryMethodRAT",
"fieldNames": {
"originTimeStamp": {
"type": "number",
"requiredOnCreate": false,
"canUpdate": true,
"validation": {
},
"optionalOnCreate": false
},
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"links": [
{
"storageResourceTags": [
"graph"
],
"from": {
"objType": {
"serviceTag": "DeliveryMethodRAT",
"objectType": "rateTable"
},
"linkType": "many",
"handler": true,
"requiredOnCreate": false
},
"to": {
"objType": {
"serviceTag": "DeliveryMethodRAT",
"objectType": "rates"
},
"linkType": "one",
"handler": true,
"requiredOnCreate": false
},
"canDelete": false
}
],
"canMove": false
}
disableRates
{
"relationshipServiceTag": "DeliveryMethodRAT",
"fieldNames": {
"originTimeStamp": {
"type": "number",
"requiredOnCreate": false,
"canUpdate": true,
"validation": {
},
"optionalOnCreate": false
},
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"links": [
{
"storageResourceTags": [
"graph"
],
"from": {
"objType": {
"serviceTag": "DeliveryMethodRAT",
"objectType": "rateTable"
},
"linkType": "many",
"handler": true,
"requiredOnCreate": false
},
"to": {
"objType": {
"serviceTag": "DeliveryMethodRAT",
"objectType": "rates"
},
"linkType": "one",
"handler": true,
"requiredOnCreate": false
},
"canDelete": false
}
],
"canMove": false
}
deliversToLocationNode
{
"relationshipServiceTag": "DeliveryMethodRAT",
"fieldNames": {
"originTimeStamp": {
"type": "number",
"requiredOnCreate": false,
"canUpdate": true,
"validation": {
},
"optionalOnCreate": false
},
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"links": [
{
"storageResourceTags": [
"graph"
],
"from": {
"objType": {
"serviceTag": "DeliveryMethodRAT",
"objectType": "rateTable"
},
"linkType": "many",
"handler": true,
"requiredOnCreate": false
},
"to": {
"objType": {
"serviceTag": "Locations",
"objectType": "locationNode"
},
"linkType": "one",
"handler": true,
"requiredOnCreate": false
},
"canDelete": false
}
],
"canMove": false
}
disabledDeliversTolocationNode
{
"relationshipServiceTag": "DeliveryMethodRAT",
"fieldNames": {
"originTimeStamp": {
"type": "number",
"requiredOnCreate": false,
"canUpdate": true,
"validation": {
},
"optionalOnCreate": false
},
},
"storageResources": {
"graph": {
"storageType": "graph",
"graphServerTag": "GraphHandler"
}
},
"links": [
{
"storageResourceTags": [
"graph"
],
"from": {
"objType": {
"serviceTag": "DeliveryMethodRAT",
"objectType": "rateTable"
},
"linkType": "many",
"handler": true,
"requiredOnCreate": false
},
"to": {
"objType": {
"serviceTag": "Locations",
"objectType": "locationNode"
},
"linkType": "one",
"handler": true,
"requiredOnCreate": false
},
"canDelete": false
}
],
"canMove": false
}
DynamoDB tables
Standard Config Table Per Service
Configuration tags
{
configTag: "ProductGraphServiceName"
configKey: "ProductGraphServiceName"
configValue: xxx // eg: "ProductGraph"
}
LogicalResultsMain
LogicalResultsData
LogicalAwaitingStep
Graph database
Service - Products Graph
Nodes
{
nodeLabel: "{DeliveryMethodRateTableLib.RATETABLE_GRAPH_NODE_LABEL}", // "rateTable"
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
rateTableId: {
identifier: true, // create unique id from request params and uniqueMessageId
},
},
}
}
Versioned data
rateTableRates
{
properties: {
rates: [
{
type: "setRate",
upToValue: xx, // numeric value that this setRate goes up to
rate: xx, // numeric rate
},
{
type: "increment",
upToValue: xx, // numeric value that this setRate goes up to
ratePerIncrement: xx, // numeric amount that rate increases per increment
increment: xx, // numeric incremental amount
},
// ..
],
},
}
Relationships
{
relationshipType: "{DeliveryMethodStandardLib.createHasDeliveryMethodRateTableGraphRelationshipType()}", // "deliversTo_locationNode"
schema: {
elementCanBeRemoved: true,
allPropertiesImmutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
}
}
{
relationshipType: "{DeliveryMethodStandardLib.createDisabledDeliveryMethodRateTableGraphRelationshipType()}", // "disabledDeliversTo_locationNode"
schema: {
elementCanBeRemoved: true,
allPropertiesImmutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
}
}
- enable/disable links to locationNodes
- after a locationNode relationship is added to a RateTable it always remains as either one of the above relationships, in order to maintain history of changes
{
relationshipType: "adjustDeliversTo_performedBy"
schema: {
elementCanBeRemoved: false,
allPropertiesImmutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
locationNodeId:
action: // "added"|"enabled"|"disabled"
},
}
}
- adds a relationship record between rateTable node and user whenever delivers to relationship added or removed
Data structure notes
- multiple deliveryMethods could point to a single rateTable
Complex Filter requests
{
filterType: "deliveryMethodRateTable" //unique id is rateTableId
type: "group",
elements:
[
{
type: "logical",
logicalTag: "deliverToLocationId",
comparison: "equals",
value: "xx"
},
{
// finds all rateTables that has at >=1 has_deliveryMethodRateTable incomming relationship from give sellOfferPlanDeliveryMethodLinkId
type: "logical",
logicalTag: "activeSellOfferPlanDeliveryMethodLinkId",
comparison: "equals",
value: "xx"
},
{
// finds all rateTables that has at >=1 has_deliveryMethodRateTable incomming relationship
type: "logical",
logicalTag: "isEnabled",
comparison: "true",
},
...
]
}