This commit is contained in:
2021-06-14 19:42:05 +00:00
parent c8ff1099a9
commit b5135c0a1a
4 changed files with 25 additions and 5 deletions

View File

@@ -1466,7 +1466,7 @@ namespace AyaNova.Biz
AyaType = AyaType.WorkOrder,
ObjectId = oProposed.WorkOrderId,
NotifySubscriptionId = sub.Id,
Name = $"{WorkorderInfo.Serial.ToString()} - {wos.Name}",
Name = $"{WorkorderInfo.Serial.ToString()}",
DecValue = GrandTotal
};
await ct.NotifyEvent.AddAsync(n);

View File

@@ -120,7 +120,19 @@ namespace AyaNova.Biz
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, AgeValue = ageValue });
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,
DecValue = ne.DecValue
});
await ct.SaveChangesAsync();
ct.NotifyEvent.Remove(ne);
await ct.SaveChangesAsync();
@@ -182,6 +194,12 @@ namespace AyaNova.Biz
if (ageValue != TimeSpan.Zero)
AgeDisplay = $"({AyaNova.Util.DateUtil.FormatTimeSpan(ageValue, LT["TimeSpanDays"], LT["TimeSpanHours"], LT["TimeSpanMinutes"], LT["TimeSpanSeconds"])})\n";
//DecValue (only for TheAndy for now workorder exceedsthreshold so not putting a lot of localization effort in; in app will localize properly)
string DecDisplay= "";
if(ne.DecValue!=0)
DecDisplay=ne.DecValue.ToString("N2", System.Globalization.CultureInfo.InvariantCulture);
string subject = "";
@@ -200,7 +218,7 @@ namespace AyaNova.Biz
subject = $"AY:{AyaTypeTranslated}:{name}:{SubscriptionTypeName}";
if (ne.ObjectId != 0 || ne.EventType == NotifyEventType.BackupStatus)
{
body = $"{AgeDisplay}{AyaTypeTranslated}\n{OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType)}\n";
body = $"{AgeDisplay}{DecDisplay}{AyaTypeTranslated}\n{OpenObjectUrlBuilder(ne.AyaType, ne.ObjectId, ne.EventType)}\n";
}
body += ne.Message;
break;

View File

@@ -28,6 +28,7 @@ namespace AyaNova.Models
public long NotifySubscriptionId { get; set; }
public string Message { get; set; }
public TimeSpan AgeValue { get; set; }
public decimal DecValue { get; set; }
[Required]
public bool Fetched { get; set; }
@@ -37,6 +38,7 @@ namespace AyaNova.Models
Fetched = false;
Name = string.Empty;
AgeValue = TimeSpan.Zero;
DecValue = 0m;
}
//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 = 927;
internal const long EXPECTED_COLUMN_COUNT = 928;
internal const long EXPECTED_INDEX_COUNT = 137;
internal const long EXPECTED_CHECK_CONSTRAINTS = 415;
internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 116;
@@ -943,7 +943,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
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, agevalue INTERVAL, eventtype INTEGER NOT NULL, "
+ "notifysubscriptionid BIGINT NOT NULL REFERENCES anotifysubscription(id) ON DELETE CASCADE, message TEXT, fetched BOOL NOT NULL)");
+ "decvalue DECIMAL(38,18) 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, "
+ "ayatype INTEGER NOT NULL, objectid BIGINT NOT NULL, eventtype INTEGER NOT NULL, notifysubscriptionid BIGINT NOT NULL, idvalue BIGINT NOT NULL, "