This commit is contained in:
2021-06-09 00:00:57 +00:00
parent dd21185cdd
commit fb259d41b3
5 changed files with 14 additions and 12 deletions

2
.vscode/launch.json vendored
View File

@@ -53,7 +53,7 @@
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_SERVER_TEST_MODE": "false",
"AYANOVA_SERVER_TEST_MODE": "true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7",
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\"

View File

@@ -1279,7 +1279,7 @@ namespace AyaNova.Biz
AyaType = AyaType.WorkOrder,
ObjectId = o.WorkOrderId,
NotifySubscriptionId = sub.Id,
Name = WorkorderInfo.Serial.ToString()
Name = $"{WorkorderInfo.Serial.ToString()} - {wos.Name}"
};
await ct.NotifyEvent.AddAsync(n);
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");
@@ -1304,12 +1304,12 @@ namespace AyaNova.Biz
{
NotifyEvent n = new NotifyEvent()
{
EventType = NotifyEventType.WorkorderStatusChange,
EventType = NotifyEventType.WorkorderStatusAge,
UserId = sub.UserId,
AyaType = AyaType.WorkOrder,
ObjectId = o.WorkOrderId,
NotifySubscriptionId = sub.Id,
Name = WorkorderInfo.Serial.ToString()
Name = $"{WorkorderInfo.Serial.ToString()} - {wos.Name}"
};
await ct.NotifyEvent.AddAsync(n);
log.LogDebug($"Adding NotifyEvent: [{n.ToString()}]");

View File

@@ -96,7 +96,7 @@ namespace AyaNova.Biz
if (deliverAfter < DateTime.UtcNow)
{
if (Subscription.DeliveryMethod == NotifyDeliveryMethod.App)
await DeliverInApp(notifyevent, ct);
await DeliverInApp(notifyevent, Subscription.AgeValue, ct);
else if (Subscription.DeliveryMethod == NotifyDeliveryMethod.SMTP)
await DeliverSMTP(notifyevent, Subscription.DeliveryAddress, ct);
}
@@ -117,10 +117,10 @@ namespace AyaNova.Biz
}
private static async Task DeliverInApp(NotifyEvent ne, AyContext ct)
private static async Task DeliverInApp(NotifyEvent ne, TimeSpan ageValue, AyContext ct)
{
log.LogTrace($"DeliverInApp notify event: {ne}");
await ct.Notification.AddAsync(new Notification() { UserId = ne.UserId, AyaType = ne.AyaType, ObjectId = ne.ObjectId, EventType = ne.EventType, NotifySubscriptionId = ne.NotifySubscriptionId, Message = ne.Message, Name = ne.Name });
await ct.Notification.AddAsync(new Notification() { UserId = ne.UserId, AyaType = ne.AyaType, ObjectId = ne.ObjectId, EventType = ne.EventType, NotifySubscriptionId = ne.NotifySubscriptionId, Message = ne.Message, Name = ne.Name, AgeValue = ageValue });
await ct.SaveChangesAsync();
ct.NotifyEvent.Remove(ne);
await ct.SaveChangesAsync();

View File

@@ -21,12 +21,13 @@ namespace AyaNova.Models
public AyaType? AyaType { get; set; }
public long? ObjectId { get; set; }
[Required]
public string Name {get;set;}//object name or closest equivalent for display
public string Name { get; set; }//object name or closest equivalent for display
[Required]
public NotifyEventType EventType { get; set; }
[Required]
public long NotifySubscriptionId { get; set; }
public string Message { get; set; }
public TimeSpan AgeValue { get; set; }
[Required]
public bool Fetched { get; set; }
@@ -34,7 +35,8 @@ namespace AyaNova.Models
{
Created = DateTime.UtcNow;
Fetched = false;
Name=string.Empty;
Name = string.Empty;
AgeValue = TimeSpan.Zero;
}
//linked entity

View File

@@ -22,7 +22,7 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
private const int DESIRED_SCHEMA_LEVEL = 1;
internal const long EXPECTED_COLUMN_COUNT = 925;
internal const long EXPECTED_COLUMN_COUNT = 926;
internal const long EXPECTED_INDEX_COUNT = 137;
internal const long EXPECTED_CHECK_CONSTRAINTS = 415;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 116;
@@ -31,7 +31,7 @@ namespace AyaNova.Util
//!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!
///////////////////////////////////////////////////////////////// C925:I137:CC415:FC116:V6:R2
///////////////////////////////////////////////////////////////// C926:I137:CC415:FC116:V6:R2
/*
@@ -944,7 +944,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
//idvalue BIGINT NOT NULL, decvalue DECIMAL(38,18) NOT NULL,
await ExecQueryAsync("CREATE TABLE anotification (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL REFERENCES auser (id), "
+ "created TIMESTAMP NOT NULL, ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, eventtype INTEGER NOT NULL, "
+ "created TIMESTAMP NOT NULL, ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, name TEXT NOT NULL, agevalue INTERVAL, eventtype INTEGER NOT NULL, "
+ "notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, message TEXT, fetched BOOL NOT NULL)");
await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed TIMESTAMP NOT NULL, "