This commit is contained in:
2020-07-16 15:54:08 +00:00
parent 12ccca9bd0
commit 35bf96e5c0
3 changed files with 13 additions and 16 deletions

View File

@@ -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()}]");
}

View File

@@ -34,6 +34,11 @@ namespace AyaNova.Models
Created = DateTime.UtcNow;
}
public override string ToString()
{
return JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.None);
}
}//eoc
}//eons

View File

@@ -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