Service - Import Data
Revision as of 12:02, 29 October 2022 by Sven the Barbarian (talk | contribs)
Overview
Orchestrates importing of objects/data into project.
Repository
https://bitbucket.org/izara-core-import-export-data/izara-core-import-data-import-data/src/master/
DynamoDB tables
Standard Config Table Per Service
Configuration tags
{
configKey: "objectType",
configTag: "xx" // {eg: sellOffer/Product/VariantProduct etc..}
configValue: {
createObectServiceName: "xx" // {service name service that handles this type}
}
},
ImportBatchMain
{
importBatchId: "xx", // random uuid
userId: "xx", // submitted by userId
startTime: currentTime.getTime(),
batchConfig: {}, // same as request
}
- partition key: importBatchId
- sort key: {none}
RawRecord
Is a raw copy, split out into fields, of one submitted record. One record may have multiple objects in it's fields.
{
importBatchId: "xx",
rawRecordId: "xx", // random uuid
fields: {}, // key is the name of the field
recordNumber: ##, // eg the line number of the record
}
- partition key: importBatchId
- sort key: rawRecordId
PendingObjectMain
One item per object that needs to be created.
{
importBatchId: "xx",
objectId: "xx", // importBatchId_random uuid
objectType: "xx", // eg variant|product|sellOffer|sellOfferPrice|sellOfferPlan|...
fields: {}, // key is the name of the field
rawRecordId: "xx",
status: "xx",
}
- partition key: importBatchId
- sort key: objectId
PendingObjectReference
Creates a link between submitted referenceId and saved object, so can find when other objects reference it.
{
importBatchId: "xx",
referenceId: "xx", // objectType_{feed supplied referenceId}
objectId: "xx", // eg variant|product|sellOffer|sellOfferPrice|sellOfferPlan|...
}
- partition key: importBatchId
- sort key: referenceId
- when creating maybe throw error if item exists with different objectId
Object hierarchy and field schema
- Some fields will be required, some optional
- some fields possibly have system defaults
- perhaps user can setup default templates (do later if has value)
- schema will need to state identifier fields for each object, if set in feed Import Data knows is pointing to existing child/parent object, if empty needs to create new
- perhaps each objectType states it's child objects, as more likely to be aware of these than parent objects
where to store/set schema
Considering external service delivers this to ImportData in Initial Setup, as seed data injected directly into Import Data Config Dynamo table.