Service - Delivery Method Standard: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 61: Line 61:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}", // "deliveryMethod"
nodeLabel: "{deliveryMethodSharedLib.consts.DELIVERYMETHOD_GRAPH_NODE_LABEL}",
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
deliveryMethodId: {
identifier: true, // create unique id from translation
},
deliveryMethodHandlerServiceNameTag: {
immutable: true,
},
currencyId: {
immutable: true, // cannot change after creating
},
defaultValueType: {}, // quantity|orderValue|productAttributeId|sellOfferTermId
defaultValueId: {}, // used for productAttributeId|sellOfferTermId
},
}
}
}
</syntaxhighlight>
</syntaxhighlight>
Line 92: Line 74:
</syntaxhighlight>
</syntaxhighlight>
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]
=== Versioned data ===
==== deliveryMethodSettings ====
<syntaxhighlight lang="JavaScript">
{
properties: {
defaultValueType: {}, // orderQuantity|orderSubtotal|productAttributeId|sellOfferTermId
defaultValueId: {}, // used for productAttributeId|sellOfferTermId
defaultValueLanguageId: {}, // used for productAttributeId|sellOfferTermId, when finding attribute value need to set language to find
defaultAccumulateValue: true // default: true, if set to false will find the largest value out of all sellOffers in the order
},
}
</syntaxhighlight>


=== Relationships ===
=== Relationships ===
Line 163: Line 160:
</syntaxhighlight>
</syntaxhighlight>
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]
* see [[NPM module - Izara Core - Property Node|DataSchemaLib]]
== Basic node schemas ==
<syntaxhighlight lang="JavaScript">
{
nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}"
schema: {
identifier: true,
restrictProperties: true,
restrictRelationships: true,
properties: {
deliveryMethodId: {
identifier: true,
},
deliveryMethodHandlerServiceNameTag: {
immutable: true,
},
},
}
}
</syntaxhighlight>
* [[Service - Translations Graph]]
* [[Service - Orders Graph]]
=== Schema comes from [[NPM module - Izara Core - Property Node|BasicNodeSchemaLib]] ===
# deliveryMethodPropertyLabel
#* [[Service - Translations Graph]]
# deliveryMethodProperty
#* [[Service - Translations Graph]]


= Complex Filter requests =
= Complex Filter requests =
Line 198: Line 165:
<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
filterType: "deliveryMethod" //unique id is deliveryMethodId
filterType: "handlerDeliveryMethod" //unique id is deliveryMethodId
type: "group",
type: "group",
elements:
elements:

Latest revision as of 03:15, 13 April 2023

Overview

Handler service for basic delivery methods that use Service - Delivery Method Rate Table for pricing.

Repository

https://bitbucket.org/izara-market-products/izara-market-products-delivery-method-standard

DynamoDB tables

Standard Config Table Per Service

Configuration tags

{
	configTag: "DeliveryMethodHandlerServiceNameTag"
	configKey: "DeliveryMethodHandlerServiceNameTag"
	configValue: xxx // this own services ServiceNameTag, eg "DeliveryMethodStandard"
}
{
	configTag: "ProductGraphServiceName"
	configKey: "ProductGraphServiceName"
	configValue: xxx // eg: "ProductGraph"
}
{
	configTag: "DeliveryMethodManagerServiceName"
	configKey: "DeliveryMethodManagerServiceName"
	configValue: xxx // eg: "DeliveryMethodManager"
}
{
	configTag: "DeliveryMethodRateTableServiceName"
	configKey: "DeliveryMethodRateTableServiceName"
	configValue: xxx // eg: "DeliveryMethodRateTable"
}
{
	configTag: "DeliveryMethodRbacServiceName"
	configKey: "DeliveryMethodRbacServiceName"
	configValue: xxx // eg: "Rbac"
}

Graph database

Service - Products Graph

Nodes

{
	nodeLabel: "{deliveryMethodSharedLib.consts.DELIVERYMETHOD_GRAPH_NODE_LABEL}",
}
{
	nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}
{
	nodeLabel: "{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}Property",
}

Versioned data

deliveryMethodSettings

{
	properties: {
		defaultValueType: {}, // orderQuantity|orderSubtotal|productAttributeId|sellOfferTermId
		defaultValueId: {}, // used for productAttributeId|sellOfferTermId
		defaultValueLanguageId: {}, // used for productAttributeId|sellOfferTermId, when finding attribute value need to set language to find
		defaultAccumulateValue: true // default: true, if set to false will find the largest value out of all sellOffers in the order
	},
}

Relationships

{
	relationshipType: "{DeliveryMethodStandardLib.createfromLocationNodeRelationshipType()}", // "from_LocationNode"
	schema: {
		elementCanBeRemoved: false,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
  • currently this is set when creating the deliveryMethod and cannot be changed, if in future we allow to be changed, will need to validate all sellOffers that link to this deliveryMethod and ensure sellOffer's stock location still slots into the deliveryMethods new from_LocationNode
{
	relationshipType: "{DeliveryMethodStandardLib.createHasDeliveryMethodRateTableGraphRelationshipType()}", // "has_deliveryMethodRateTable"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
{
	relationshipType: "{DeliveryMethodStandardLib.createDisabledDeliveryMethodRateTableGraphRelationshipType()}", // "disabled_deliveryMethodRateTable"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
{
	relationshipType: "{DeliveryMethodStandardLib.createHasDeliveryMethodRateTableGraphRelationshipType()}", // "owns_deliveryMethodRateTable"
	schema: {
		elementCanBeRemoved: true,
		allPropertiesImmutable: true,
		restrictProperties: true,
		properties: {
			originTimestamp: //timestamp the request to create/change this relationship was sent
		},
	}
}
  • controls ownership of a rateTable, many deliveryMethods can point to one rateTable but only one deliveryMethod controls it (RBAC for that deliveryMethods allows control over the rateTable)
{
	relationshipType: "has_{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}Property",
}
{
	relationshipType: "disabled_{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}Property",
}
{
	relationshipType: "is_{DeliveryMethodStandardLib.DELIVERYMETHOD_GRAPH_NODE_LABEL}PropertyLabel",
}

Complex Filter requests

{
	filterType: "handlerDeliveryMethod" //unique id is deliveryMethodId
	type: "group",
	elements:
	[
		{
			type: "logical",
			logicalTag: "currencyId",
			comparison: "equals",
			value: "xx"
		},
		{
			type: "logical",
			logicalTag: "fromLocationNodeId",
			comparison: "equals",
			value: "xx"
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "deliveryMethodRateTable",
				// see [[Service - Delivery Method Rate Table|Complex Filter requests]]
			}
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "deliveryMethodProperty",
				// see [[NPM module - Izara Core - Property Node|Complex Filter requests]]
			}
		},
		{
			type: "complexFilter",
			complexFilter: {
				filterType: "deliveryMethodNameTranslation" //unique id is deliveryMethodId
				type: "group",
				elements: 
				[
					{
						// see [[Service - Translations|Complex Filter requests]]
						type: "logical",
						logicalTag: "textTag_languageId_text",
						resultType: "deliveryMethod",
						textTag: "deliveryMethodName",
						languageId: "en",
						text: "Is a great term",
						subjectIdentifierPropertyName: "deliveryMethodId",
						caseSensitive: true
					},
				]
			}
		},		
		...
	]
}

Translate Ids - deliveryMethodRateTable to deliveryMethod

  • only find deliveryMethodIds that are enabled

Data structure notes

  • Users can create new deliveryMethods which are uniquely identified by their translation
  • deliveryMethods have RBAC structure, default to creator having admin permissions, but admin can add other roles etc..
  • Any user can attach any deliveryMethod to a SellOfferPlan

Working documents

Delivery Method Standard