This commit is contained in:
@@ -110,11 +110,11 @@ namespace AyaNova.Biz
|
|||||||
//then *this* code will go through and look for subscriptions related to that event
|
//then *this* code will go through and look for subscriptions related to that event
|
||||||
//this way the biz object code can be "dumb" about notifications in general and just let this code handle it as needed
|
//this way the biz object code can be "dumb" about notifications in general and just let this code handle it as needed
|
||||||
//will iterate the subscriptions and see if any apply here
|
//will iterate the subscriptions and see if any apply here
|
||||||
internal static async Task HandlePotentialNotificationEvent(AyaType ayaType, AyaEvent ayaEvent, BizObject newObject, BizObject currentObject)
|
internal static async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel newObject, ICoreBizObjectModel currentObject)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
log.LogTrace($"HandlePotentialNotificationEvent processing: [AyaType:{ayaType}, AyaEvent:{ayaEvent}]");
|
log.LogTrace($"HandlePotentialNotificationEvent processing: [AyaType:{newObject.AyaType}, AyaEvent:{ayaEvent}]");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ namespace AyaNova.Biz
|
|||||||
switch (ayaEvent)
|
switch (ayaEvent)
|
||||||
{
|
{
|
||||||
case AyaEvent.Created:
|
case AyaEvent.Created:
|
||||||
switch (ayaType)
|
switch (newObject.AyaType)
|
||||||
{
|
{
|
||||||
//AyaTypes with their own special notification related events
|
//AyaTypes with their own special notification related events
|
||||||
|
|
||||||
@@ -138,10 +138,10 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
//ObjectCreated subscriptions
|
//ObjectCreated subscriptions
|
||||||
{
|
{
|
||||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == NotifyEventType.ObjectCreated && z.AyaType == 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)
|
||||||
{
|
{
|
||||||
NotifyEvent n = new NotifyEvent() { EventType = NotifyEventType.ObjectCreated, UserId = sub.UserId, AyaType=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);
|
||||||
}
|
}
|
||||||
if (subs.Count > 0)
|
if (subs.Count > 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user