Service - Delivery Method Rate Table: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
(Created page with "= 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 ma...")
 
 
(10 intermediate revisions by the same user not shown)
Line 20: Line 20:
}
}
</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 36: Line 45:
properties: {
properties: {
rateTableId: {
rateTableId: {
identifier: true, // create unique id from translation
identifier: true, // create unique id from request params and uniqueMessageId
},
},
},
},
Line 42: Line 51:
}
}
</syntaxhighlight>
</syntaxhighlight>
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]


=== Versioned data ===
=== Versioned data ===
Line 49: Line 56:
==== rateTableRates ====
==== rateTableRates ====


<syntaxhighlight lang="JavaScript">
{
{
properties: {
properties: {
Line 67: Line 75:
},
},
}
}
</syntaxhighlight>


=== Relationships ===
=== Relationships ===
<syntaxhighlight lang="JavaScript">
{
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: {
elementCanBeRemoved: true,
allPropertiesImmutable: true,
restrictProperties: true,
properties: {
originTimestamp: //timestamp the request to create/change this relationship was sent
},
}
}
</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">
{
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"
},
}
}
</syntaxhighlight>
* adds a relationship record between rateTable node and user whenever delivers to relationship added or removed


= Data structure notes =
= Data structure notes =


* multiple deliveryMethods could point to a single rateTable
* multiple deliveryMethods could point to a single rateTable
= Complex Filter requests =
<syntaxhighlight lang="JavaScript">
{
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",
},
...
]
}
</syntaxhighlight>


= Working documents =
= Working documents =

Latest revision as of 12:12, 1 February 2023

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

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configTag: "ProductGraphServiceName"
	configKey: "ProductGraphServiceName"
	configValue: xxx // eg: "ProductGraph"
}

LogicalResultsMain

LogicalResultsMain

LogicalResultsData

LogicalResultsData

LogicalAwaitingStep

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",
		},		
		...
	]
}

Working documents

Delivery Method Rate Table