Service - Unit Manager: Difference between revisions

From Izara Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
= Overview =
= Overview =


Each unit is handled by a [[Service - Unit (handlers)]] service.
Each tracked unit is handled by a [[Service - Unit (handlers)]] service.


The Unit Manager service handles shared orchestration of the Unit Handler services.
The Unit Manager service handles shared orchestration of the Unit Handler services and the base unit objectType.


= Repository =
= Repository =


https://bitbucket.org/izara-market-products/izara-market-products-unit-manager
https://bitbucket.org/izara-supply-units/izara-supply-units-unit-manager


= DynamoDB tables =
= DynamoDB tables =
== [[Standard Config Table Per Service]] ==
=== Configuration tags ===
<syntaxhighlight lang="JavaScript">
{
configKey: "SupplyGraphServiceName"
configTag: "SupplyGraphServiceName"
configValue: xxx // eg: "SupplyGraph"
}
</syntaxhighlight>
<syntaxhighlight lang="JavaScript">
{
configKey: "UnitHandlerService"
configTag: xxx // unitHandlerServiceNameTag, eg: "UnitStandard"|"UnitPacking", this is what is saved in each record
configValue: {
serviceName: xxx // eg: "UnitStandard", this is the actual deployed service name}
}
}
</syntaxhighlight>


== UnitRecord ==
== UnitRecord ==
Line 47: Line 25:
* sort key: (none)
* sort key: (none)


= Graph database =
= objectSchemas =  
 
== [[Service - Supply Graph]]==
 
=== Nodes ===


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
{
nodeLabel: "{UnitSharedLib.UNIT_GRAPH_NODE_LABEL}", // stored in shared npm, shared by all unit Handlers
objectType: "unit",
schema: {
storageResources:{
identifier: true,
"xxx":{
restrictProperties: true,
storageType: "graph",
restrictRelationships: true,
graphServerTag: "xx",
properties: {
}
unitId: {
},
identifier: true, //(random uuid)
fieldNames: {
},
unitId: {
unitHandlerServiceNameTag: {
type: "string",
immutable: true,
            randomOnCreate: true
},
},
},
identifiers: [
{
fieldName: "unitId"
},
},
}
]
}
},
</syntaxhighlight>
</syntaxhighlight>
* Unit Manager is responsible for this object type because shared by all Unit Handlers


=== Relationships ===
= relationshipSchemas =  


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
[
relationshipType: "{UnitSharedLib.UNIT_OWNED_BY_USER_GRAPH_REL_TYPE}", // "unitOwnedBy_user"
  {
schema: {
    "unitOwnedByUser": {
elementCanBeRemoved: true,
      storageResources:{
allPropertiesImmutable: false,
"xxx":{
restrictProperties: true,
storageType: "graph",
properties: {
graphServerTag: "xx",
originTimestamp: //timestamp the request to create/change this relationship was sent
}
},
      },
}
      links: [
}
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "user",
              objectType: "user"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
</syntaxhighlight>
</syntaxhighlight>
* Links to the user who currently owns the unit
 
* links to the user who currently owns the unit


<syntaxhighlight lang="JavaScript">
<syntaxhighlight lang="JavaScript">
{
[
relationshipType: "{UnitSharedLib.UNIT_PREVIOUSLY_OWNED_BY_USER_GRAPH_REL_TYPE}", // "unitPreviouslyOwnedBy_user"
  {
schema: {
    "unitPreviouslyOwnedByUser": {
elementCanBeRemoved: false,
      storageResources:{
allPropertiesImmutable: true,
"xxx":{
restrictProperties: true,
storageType: "graph",
properties: {
graphServerTag: "xx",
originTimestamp: //timestamp the request to create/change this relationship was sent
}
fromTimestamp: //timestamp ownership began
    },
toTimestamp: //timestamp ownership ended
fieldNames: {
},
        "fromTimestamp": {
}
          type: "timestamp",
}
          requiredOnCreate: true,
        },
        "toTimestamp": {
          type: "timestamp",
          requiredOnCreate: true,
        }
    },     
    links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "user",
              objectType: "user"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
</syntaxhighlight>
</syntaxhighlight>
* Links to users who previously owned the unit
 
* Method of creating this link will be similar to versionedData, creating a new unitOwnedBy_user relationship at the same time as creating a new unitPreviouslyOwnedBy_user relationship
* links to users who previously owned the unit
* method of creating this link will be similar to versionedData, creating a new unitOwnedByUser relationship at the same time as creating a new unitPreviouslyOwnedByUser relationship


= Ownership =
= Ownership =
Line 113: Line 141:
* Owner can set user level permissions for other users to manage their units, like any other user owned object
* Owner can set user level permissions for other users to manage their units, like any other user owned object
* New owner needs to accept ownership transfer for it to complete (in future could setup automatic accepatance configuration)
* New owner needs to accept ownership transfer for it to complete (in future could setup automatic accepatance configuration)
* Existing permissions can transfer across, and need to be managed by new owner


= Working documents =
= Working documents =

Revision as of 14:29, 15 February 2025

Overview

Each tracked unit is handled by a Service - Unit (handlers) service.

The Unit Manager service handles shared orchestration of the Unit Handler services and the base unit objectType.

Repository

https://bitbucket.org/izara-supply-units/izara-supply-units-unit-manager

DynamoDB tables

UnitRecord

Records which Handler manages each unit

{
	unitId
	unitHandlerServiceNameTag
}
  • partition key: unitId
  • sort key: (none)

objectSchemas

{
	objectType: "unit",
	storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
	},
	fieldNames: {
		unitId: {
			type: "string",
            randomOnCreate: true
		},
	},
	identifiers: [
		{
			fieldName: "unitId"
		},
	]
},

relationshipSchemas

[
  {
    "unitOwnedByUser": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
      },
      links: [
        {
          storageResourceTags: ["xxx"],
          canDelete: true,
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "user",
              objectType: "user"
            },
            linkType: "one",
          }
        }
      ]
    }
  }
]
  • links to the user who currently owns the unit
[
  {
    "unitPreviouslyOwnedByUser": {
      storageResources:{
		"xxx":{
			storageType: "graph",
			graphServerTag: "xx",
		}
    },
	fieldNames: {
        "fromTimestamp": {
          type: "timestamp",
          requiredOnCreate: true,
        },
        "toTimestamp": {
          type: "timestamp",
          requiredOnCreate: true,
        }
    },      
    links: [
        {
          storageResourceTags: ["xxx"],
          from: {
            objType: {
              serviceTag: "unitManager",
              objectType: "unit"
            },
            linkType: "many",
          },
          to: {
            objType: {
              serviceTag: "user",
              objectType: "user"
            },
            linkType: "many",
          }
        }
      ]
    }
  }
]
  • links to users who previously owned the unit
  • method of creating this link will be similar to versionedData, creating a new unitOwnedByUser relationship at the same time as creating a new unitPreviouslyOwnedByUser relationship

Ownership

  • Each Unit is owned by one user, who can transfer ownership to another user
  • Owner can set user level permissions for other users to manage their units, like any other user owned object
  • New owner needs to accept ownership transfer for it to complete (in future could setup automatic accepatance configuration)
  • Existing permissions can transfer across, and need to be managed by new owner

Working documents

Unit Manager