This commit is contained in:
@@ -76,7 +76,8 @@ namespace AyaNova.Biz
|
|||||||
//this will likely be a development error, not a production error so no need to log etc
|
//this will likely be a development error, not a production error so no need to log etc
|
||||||
throw new System.ArgumentException("NotifyEventProcessor:AddGeneralNotifyEvent: DefaultNotification requires a user id but none was specified");
|
throw new System.ArgumentException("NotifyEventProcessor:AddGeneralNotifyEvent: DefaultNotification requires a user id but none was specified");
|
||||||
}
|
}
|
||||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = 0 };
|
var UserName = await ct.User.Where(z => z.Id == userId).Select(z => z.Name).FirstOrDefaultAsync();
|
||||||
|
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = userId, Message = message, NotifySubscriptionId = 0, Name = UserName };
|
||||||
await ct.NotifyEvent.AddAsync(n);
|
await ct.NotifyEvent.AddAsync(n);
|
||||||
await ct.SaveChangesAsync();
|
await ct.SaveChangesAsync();
|
||||||
return;
|
return;
|
||||||
@@ -87,7 +88,8 @@ namespace AyaNova.Biz
|
|||||||
var subs = await ct.NotifySubscription.Where(z => z.EventType == eventType).ToListAsync();
|
var subs = await ct.NotifySubscription.Where(z => z.EventType == eventType).ToListAsync();
|
||||||
foreach (var sub in subs)
|
foreach (var sub in subs)
|
||||||
{
|
{
|
||||||
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = sub.UserId, Message = message, NotifySubscriptionId = sub.Id };
|
//note flag ~SERVER~ means to client to substitute "Server" translation key text instead
|
||||||
|
NotifyEvent n = new NotifyEvent() { EventType = eventType, UserId = sub.UserId, Message = message, NotifySubscriptionId = sub.Id, Name = "~SERVER~" };
|
||||||
await ct.NotifyEvent.AddAsync(n);
|
await ct.NotifyEvent.AddAsync(n);
|
||||||
}
|
}
|
||||||
if (subs.Count > 0)
|
if (subs.Count > 0)
|
||||||
@@ -206,9 +208,9 @@ namespace AyaNova.Biz
|
|||||||
if (TagsMatch(newObject.Tags, sub.Tags))
|
if (TagsMatch(newObject.Tags, sub.Tags))
|
||||||
{
|
{
|
||||||
//Note: age is set by advance notice which is consulted by CoreJobNotify in it's run so the deliver date is not required here only the reference EventDate to check for deliver
|
//Note: age is set by advance notice which is consulted by CoreJobNotify in it's run so the deliver date is not required here only the reference EventDate to check for deliver
|
||||||
//ObjectAge is determined by subscription AgeValue in combo with the EventDate NotifyEvent parameter which together determines at what age from notifyevent.EventDate it's considered for the event to have officially occured
|
//ObjectAge is determined by subscription AgeValue in combo with the EventDate NotifyEvent parameter which together determines at what age from notifyevent.EventDate it's considered for the event to have officially occured
|
||||||
//However delivery is determined by sub.advancenotice so all three values play a part
|
//However delivery is determined by sub.advancenotice so all three values play a part
|
||||||
//
|
//
|
||||||
NotifyEvent n = new NotifyEvent()
|
NotifyEvent n = new NotifyEvent()
|
||||||
{
|
{
|
||||||
EventType = NotifyEventType.ObjectAge,
|
EventType = NotifyEventType.ObjectAge,
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace AyaNova.Models
|
|||||||
public AyaType AyaType { get; set; }
|
public AyaType AyaType { get; set; }
|
||||||
public long ObjectId { get; set; }
|
public long ObjectId { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
|
public string Name {get;set;}//object name or closest equivalent for display
|
||||||
|
[Required]
|
||||||
public NotifyEventType EventType { get; set; }
|
public NotifyEventType EventType { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public long UserId { get; set; }
|
public long UserId { get; set; }
|
||||||
@@ -46,6 +48,7 @@ namespace AyaNova.Models
|
|||||||
// AgeValue = TimeSpan.Zero;
|
// AgeValue = TimeSpan.Zero;
|
||||||
AyaType = AyaType.NoType;
|
AyaType = AyaType.NoType;
|
||||||
ObjectId = 0;
|
ObjectId = 0;
|
||||||
|
Name=string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override string ToString()
|
public override string ToString()
|
||||||
|
|||||||
@@ -689,7 +689,7 @@ $BODY$;
|
|||||||
"deliveryaddress text, attachreportid bigint not null, tags varchar(255) ARRAY)");
|
"deliveryaddress text, attachreportid bigint not null, tags varchar(255) ARRAY)");
|
||||||
|
|
||||||
await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " +
|
await ExecQueryAsync("CREATE TABLE anotifyevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, " +
|
||||||
"ayatype integer not null, objectid bigint not null, eventtype integer not null, notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, " +
|
"ayatype integer not null, objectid bigint not null, name varchar(255) not null, eventtype integer not null, notifysubscriptionid bigint not null references anotifysubscription(id) on delete cascade, " +
|
||||||
"userid bigint not null, idvalue bigint not null, decvalue decimal(19,4) not null, eventdate timestamp, message text)");
|
"userid bigint not null, idvalue bigint not null, decvalue decimal(19,4) not null, eventdate timestamp, message text)");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user