diff --git a/server/AyaNova/biz/NotifyEventProcessor.cs b/server/AyaNova/biz/NotifyEventProcessor.cs index 84ef2fac..eedd152c 100644 --- a/server/AyaNova/biz/NotifyEventProcessor.cs +++ b/server/AyaNova/biz/NotifyEventProcessor.cs @@ -40,9 +40,8 @@ namespace AyaNova.Biz public static async Task AddEvent(NotifyEvent ev) { - //iterate subs, figure out who gets this event - //add to table for any that do + log.LogTrace($"AddEvent processing: [{ev.ToString()}]"); try { @@ -51,27 +50,20 @@ namespace AyaNova.Biz using (AyContext ct = AyaNova.Util.ServiceProviderProvider.DBContext) { - //select all jobs with no deliver date or deliver date no longer in future - - //### PLAN if it's an smtp delivery that fails and it's to someone who can be delivered in app then it should send an inapp notification of - //delivery failure and still delete the smtp delivery - //If it's not possible to notify the person via in app of the failed smtp then perhaps it notifies OPS personnel and biz admin personnel - //NEW NOTIFICATION SUBSCRIPTION EVENT TYPE: - //OPERATIONS_PROBLEMS - backup, notifications, out of memory, what have you, anyone can subscribe to it regardless of rights - //this is just to let people know there is a problem - + //iterate subs, figure out who gets this event + //add to table for any that do + var subs=await ct.NotifySubscription.AsNoTracking().Where(z=>z.EventType==ev.EventType &&) } } catch (Exception ex) { - + log.LogError(ex, $"Error adding notification event: [{ev.ToString()}]"); } finally { - log.LogTrace("Notify is done setting to not running state and tagging lastRun timestamp"); - lastRun = DateTime.UtcNow; - NotifyIsRunning = false; + log.LogTrace($"Notify event processed: [{ev.ToString()}]"); + } diff --git a/server/AyaNova/models/NotifyEvent.cs b/server/AyaNova/models/NotifyEvent.cs index 277284ca..c6a6f670 100644 --- a/server/AyaNova/models/NotifyEvent.cs +++ b/server/AyaNova/models/NotifyEvent.cs @@ -34,6 +34,11 @@ namespace AyaNova.Models Created = DateTime.UtcNow; } + public override string ToString() + { + return JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.None); + } + }//eoc }//eons diff --git a/server/AyaNova/models/NotifySubscription.cs b/server/AyaNova/models/NotifySubscription.cs index 8c5cf300..d1ddda57 100644 --- a/server/AyaNova/models/NotifySubscription.cs +++ b/server/AyaNova/models/NotifySubscription.cs @@ -16,7 +16,7 @@ namespace AyaNova.Models [Required] public long UserId { get; set; } - public AyaType? AyaType { get; set; } + public AyaType? AyaType { get; set; }//Note: could be Global meaning any corebiz object would be included if relevant (e.g. ObjectCreated) [Required] public NotifyEventType EventType { get; set; } public TimeSpan? AdvanceNotice { get; set; } //Note: I've been doing nullable wrong sort of: https://stackoverflow.com/a/29149207/8939