Service - User Contact Manager: Difference between revisions
Jump to navigation
Jump to search
(→Fields) |
No edit summary |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 7: | Line 7: | ||
https://bitbucket.org/stb_working/user-contact-manager/src/master/ | https://bitbucket.org/stb_working/user-contact-manager/src/master/ | ||
= | = Object Schemas = | ||
== | == objType == | ||
=== | === userContact === | ||
<syntaxhighlight lang="JavaScript"> | |||
{ | |||
objectType: "userContact", | |||
canDelete: false, | |||
complexFilterServiceTag: "complexFilter", | |||
overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function | |||
create: ['hdrApi', 'hdrSqs'], // default: ['hdrApi', 'hdrSqs'] | |||
update: ['hdrApi', 'hdrSqs'], // default: ['hdrApi', 'hdrSqs'] | |||
get: [], // default: ['hdrApi', 'hdrInv'] | |||
delete: [], // default: ['hdrApi', 'hdrSqs'] | |||
}, | |||
// overwriteGeneratedMainFunction: ["create"], | |||
addOnDataStructure: [ | |||
{ | |||
type: "versionedData", | |||
versionedDataLabel: "userContactSettings", | |||
storageResourceTag: "myGraph", | |||
fieldNames: [ | |||
{ // fieldName in versionedData should now same in main objectSchema | |||
fieldName: "enable", | |||
type: "boolean", | |||
optionalOnCreate: true, | |||
canUpdate: true, | |||
validation: { | |||
pattern: pattern | |||
} | |||
} | |||
] | |||
} | |||
], | |||
storageResources: { | |||
myGraph: { | |||
storageType: "graph", | |||
graphServerTag: "GraphHandler" | |||
} | |||
}, | |||
fieldNames: { // see Per Service Schemas | |||
userContactId: { | |||
type: "string", | |||
optionalOnCreate: true, | |||
canUpdate: false, | |||
validation: { | |||
pattern: pattern | |||
}, | |||
storageResourceTags: ['myGraph'] | |||
}, | |||
methodTag: { | |||
type: "string", | |||
requiredOnCreate: true, | |||
canUpdate: false, | |||
validation: { | |||
pattern: pattern | |||
}, | |||
storageResourceTags: ['myGraph'] | |||
}, | |||
uniqueId: { | |||
type: "string", | |||
requiredOnCreate: true, | |||
canUpdate: false, | |||
validation: { | |||
pattern: pattern | |||
}, | |||
storageResourceTags: ['myGraph'] | |||
}, | |||
userId: { | |||
type: "string", | |||
requiredOnCreate: true, | |||
canUpdate: false, | |||
validation: { | |||
pattern: pattern | |||
}, | |||
storageResourceTags: ['myGraph'] | |||
} | |||
}, | |||
identifiers: [ | |||
{ | |||
type: "identifier", | |||
fieldNames: ["methodTag", "uniqueId"], | |||
name: "userContactId" | |||
} | |||
] | |||
} | |||
</syntaxhighlight> | |||
==== fieldNames ==== | |||
; userContactId | ; userContactId | ||
: comes from {methodTag}_{methods uniqueId, eg: emailUniqueId} | : comes from {methodTag}_{methods uniqueId, eg: emailUniqueId} | ||
; | ; methodTag | ||
: comes from {serviceName} of receiver service | |||
; uniqueId | |||
: random UUID from receiver service | |||
; userId | |||
: id of user that create userContact | |||
; enabled | |||
: true|false | |||
== RefObjectRelationships == | |||
<syntaxhighlight lang="JavaScript"> | |||
// reference to relationshipTag in external service | |||
[ | |||
{ | |||
objectType: "userContact", // objectType in local service | |||
relationshipTag: "has_notificationGroup", // name of relationshiptag of objType | |||
relationshipServiceTag: "NotificationManager" // point to service tag that contain data of relationshipTag of objType | |||
}, | |||
{ | |||
objectType: "userContact", // objectType in local service | |||
relationshipTag: "disabled_notificationGroup", // name of relationshiptag of objType | |||
relationshipServiceTag: "NotificationManager" // point to service tag that contain data of relationshipTag of objType | |||
}, | |||
] | |||
</syntaxhighlight> | |||
= Creating a new user contact = | = Creating a new user contact = |
Latest revision as of 01:48, 9 August 2024
Overview
Manages contact methods available to users. Records each users contacts.
Repository
https://bitbucket.org/stb_working/user-contact-manager/src/master/
Object Schemas
objType
userContact
{
objectType: "userContact",
canDelete: false,
complexFilterServiceTag: "complexFilter",
overWriteHandlers: { // optional, if not set will create default handlers, if empty will not create handler and main function
create: ['hdrApi', 'hdrSqs'], // default: ['hdrApi', 'hdrSqs']
update: ['hdrApi', 'hdrSqs'], // default: ['hdrApi', 'hdrSqs']
get: [], // default: ['hdrApi', 'hdrInv']
delete: [], // default: ['hdrApi', 'hdrSqs']
},
// overwriteGeneratedMainFunction: ["create"],
addOnDataStructure: [
{
type: "versionedData",
versionedDataLabel: "userContactSettings",
storageResourceTag: "myGraph",
fieldNames: [
{ // fieldName in versionedData should now same in main objectSchema
fieldName: "enable",
type: "boolean",
optionalOnCreate: true,
canUpdate: true,
validation: {
pattern: pattern
}
}
]
}
],
storageResources: {
myGraph: {
storageType: "graph",
graphServerTag: "GraphHandler"
}
},
fieldNames: { // see Per Service Schemas
userContactId: {
type: "string",
optionalOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
methodTag: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
uniqueId: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
},
userId: {
type: "string",
requiredOnCreate: true,
canUpdate: false,
validation: {
pattern: pattern
},
storageResourceTags: ['myGraph']
}
},
identifiers: [
{
type: "identifier",
fieldNames: ["methodTag", "uniqueId"],
name: "userContactId"
}
]
}
fieldNames
- userContactId
- comes from {methodTag}_{methods uniqueId, eg: emailUniqueId}
- methodTag
- comes from {serviceName} of receiver service
- uniqueId
- random UUID from receiver service
- userId
- id of user that create userContact
- enabled
- true|false
RefObjectRelationships
// reference to relationshipTag in external service
[
{
objectType: "userContact", // objectType in local service
relationshipTag: "has_notificationGroup", // name of relationshiptag of objType
relationshipServiceTag: "NotificationManager" // point to service tag that contain data of relationshipTag of objType
},
{
objectType: "userContact", // objectType in local service
relationshipTag: "disabled_notificationGroup", // name of relationshiptag of objType
relationshipServiceTag: "NotificationManager" // point to service tag that contain data of relationshipTag of objType
},
]
Creating a new user contact
- This service presents a list of available contact methods
- User choses one and and is directed to that contact method handler to create the actual entry
- Once the user contact is created in the handler service a message gets sent to this service which creates it's own UserContacts record
Creating a new notification group
- This service presents a list of the users contacts
- How do we handle authentication, notification manager has no record of the userId eg for notificationGroups, only UCM has this
- (for now not direct to notification manager, any updates go through UCM, but if can figure out some token system could go direct to notification manager) User choses one and is directed to Notification Manager service
- For the endpoint given to Notification Manager try having notifications go directly to the contact method handler. Another option would be to pass back through this service but I cannot see any benefit in this.
- Notification Manager completes the flow, creating a notification group and associated notification records
Location specific contact methods
- Could add ways of restricting the available contact methods to ones the user is likely to want
- eg: by location (eg country)
- but have a way that the user can choose any method
Notes
- If method handler changes the contactName, a message will be sent to User Contact Manager to update its record, contactName is part of the sort key, not sure if it can be updated, if not need to copy the record to a new record with the updated contactName
- If method handler disables a contact, disable here and send message to Notification Manager service which will disable notifications and tell Activity Switchboard service to remove all associated triggers
Ideas
...