This commit is contained in:
2020-07-17 17:03:00 +00:00
parent 7ccb7feeb4
commit edd95860e7
2 changed files with 80 additions and 82 deletions

View File

@@ -127,6 +127,7 @@ namespace AyaNova.Biz
switch (ayaEvent) switch (ayaEvent)
{ {
case AyaEvent.Created: case AyaEvent.Created:
//Specific created related subscriptions for AyaType
switch (newObject.AyaType) switch (newObject.AyaType)
{ {
//AyaTypes with their own special notification related events //AyaTypes with their own special notification related events
@@ -138,22 +139,19 @@ namespace AyaNova.Biz
break; break;
} }
//ObjectCreated subscriptions //General ObjectCreated subscriptions
{ {
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == newObject.AyaType).ToListAsync(); var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == newObject.AyaType).ToListAsync();
foreach (var sub in subs) foreach (var sub in subs)
{ {
//todo: match tags if necessary
if (TagsMatch(newObject.Tags, sub.Tags)) if (TagsMatch(newObject.Tags, sub.Tags))
{ {
NotifyEvent n = new NotifyEvent() { EventType = NotifyEventType.ObjectCreated, UserId = sub.UserId, AyaType = newObject.AyaType, ObjectId = newObject.Id, SubscriptionId = sub.Id }; NotifyEvent n = new NotifyEvent() { EventType = NotifyEventType.ObjectCreated, UserId = sub.UserId, AyaType = newObject.AyaType, ObjectId = newObject.Id, SubscriptionId = sub.Id };
await ct.NotifyEvent.AddAsync(n); await ct.NotifyEvent.AddAsync(n);
log.LogTrace($"Adding NotifyEvent: [{n.ToString()}]");
SaveContext = true; SaveContext = true;
} }
} }
} }
break; break;
case AyaEvent.Modified: case AyaEvent.Modified:

View File

@@ -10,18 +10,18 @@ namespace AyaNova.Biz
{ {
//see core-notifications.txt spec doc for a bit more info on each type (they are named a little bit differently) //see core-notifications.txt spec doc for a bit more info on each type (they are named a little bit differently)
ObjectDeleted = 1, ObjectDeleted = 1,//Deletion of any object of conditional specific AyaType and optionally conditional tags
ObjectCreated = 2, ObjectCreated = 2,//creation of any object of conditional specific AyaType and optionally conditional tags
ObjectModified = 3, ObjectModified = 3,//Modification / update of any kind of any object of conditional specific AyaType and optionally conditional tags
WorkorderStatusChange = 4, WorkorderStatusChange = 4,//Workorder object, any *change* of status including from no status (new) to a specific conditional status ID value
ContractExpiring = 5, ContractExpiring = 5,//Contract object, aged notification with optional advance notice for expiration date of contract. Customer version and User version deliveries possible.
CSRAccepted = 6, CSRAccepted = 6,//CustomerServiceRequest object, saved with ACCEPTED status, delivered to Customer only
CSRRejected = 7, CSRRejected = 7,//CustomerServiceRequest object, saved with REJECTED status, delivered to Customer only
WorkorderClosed = 8,//Deprecated? Now fulfilled by workorder status specifically, or.. perhaps this still exists but as when wo set to any closed type status? There is a todo in client end related to thsi DEPRECATED_8 = 8,//UNUSED, FILL IN LATER WITH NEXT NEW NOTIFICATION EVENT
QuoteStatusChange = 9,//quote created / modified QuoteStatusChange = 9,//Quote object, any *change* of status including from no status (new) to a specific conditional status ID value
ObjectAge = 10,//upon object created, conditional on AgeValue ObjectAge = 10,//Any object, Age (conditional on AgeValue) after creation event of any object of conditional specific AyaType and optionally conditional tags
ServiceBankDepleted = 11,//any change to service bank triggers this check ServiceBankDepleted = 11,//ServiceBank object, any change to balance triggers this check, conditional on decvalue as remaining balance left to trigger this notification
ReminderImminent = 12, ReminderImminent = 12,//Reminder object
ScheduledOnWorkorder = 13, ScheduledOnWorkorder = 13,
ScheduledOnWorkorderImminent = 14, ScheduledOnWorkorderImminent = 14,
WorkorderCloseByPassed = 15, WorkorderCloseByPassed = 15,