From 16a055329153171c73d36aa739d830c17c759b93 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 23 Jul 2020 22:43:58 +0000 Subject: [PATCH] --- server/AyaNova/Controllers/EnumListController.cs | 2 ++ server/AyaNova/biz/NotifyEventProcessor.cs | 2 ++ server/AyaNova/models/UserOptions.cs | 6 ++---- server/AyaNova/resource/de.json | 3 +-- server/AyaNova/resource/en.json | 3 +-- server/AyaNova/resource/es.json | 3 +-- server/AyaNova/resource/fr.json | 3 +-- server/AyaNova/util/AySchema.cs | 4 ++-- 8 files changed, 12 insertions(+), 14 deletions(-) diff --git a/server/AyaNova/Controllers/EnumListController.cs b/server/AyaNova/Controllers/EnumListController.cs index 221944e7..b7a24dc0 100644 --- a/server/AyaNova/Controllers/EnumListController.cs +++ b/server/AyaNova/Controllers/EnumListController.cs @@ -296,6 +296,7 @@ namespace AyaNova.Api.Controllers TranslationKeysToFetch.Add("NotifyEventUnitWarrantyExpiry"); TranslationKeysToFetch.Add("NotifyEventUnitMeterReadingMultipleExceeded"); TranslationKeysToFetch.Add("NotifyEventServerOperationsProblem"); + TranslationKeysToFetch.Add("NotifyEventGeneralNotification"); var LT = await TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, translationId); @@ -327,6 +328,7 @@ namespace AyaNova.Api.Controllers ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventUnitWarrantyExpiry"], Id = (long)NotifyEventType.UnitWarrantyExpiry }); ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventUnitMeterReadingMultipleExceeded"], Id = (long)NotifyEventType.UnitMeterReadingMultipleExceeded }); ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventServerOperationsProblem"], Id = (long)NotifyEventType.ServerOperationsProblem }); + ReturnList.Add(new NameIdItem() { Name = LT["NotifyEventGeneralNotification"], Id = (long)NotifyEventType.GeneralNotification }); } else if (keyNameInLowerCase == StringUtil.TrimTypeName(typeof(NotifyDeliveryMethod).ToString()).ToLowerInvariant()) diff --git a/server/AyaNova/biz/NotifyEventProcessor.cs b/server/AyaNova/biz/NotifyEventProcessor.cs index a3808c2c..0b4dab35 100644 --- a/server/AyaNova/biz/NotifyEventProcessor.cs +++ b/server/AyaNova/biz/NotifyEventProcessor.cs @@ -76,7 +76,9 @@ namespace AyaNova.Biz //this will likely be a development error, not a production error so no need to log etc throw new System.ArgumentException("NotifyEventProcessor:AddGeneralNotifyEvent: GeneralNotification requires a user id but none was specified"); } + 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.SaveChangesAsync(); diff --git a/server/AyaNova/models/UserOptions.cs b/server/AyaNova/models/UserOptions.cs index 6ac04db3..b57b06c5 100644 --- a/server/AyaNova/models/UserOptions.cs +++ b/server/AyaNova/models/UserOptions.cs @@ -10,11 +10,11 @@ namespace AyaNova.Models [Required] public long TranslationId { get; set; } - + //------------- [EmailAddress] public string EmailAddress { get; set; } - public bool CopyGeneralNotificationsToEmail { get; set; }//in addition to deliving general notification in-app, also send a copy to email address + /* Hexadecimal notation: #RGB[A] R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (0–9, A–F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388. @@ -29,7 +29,6 @@ namespace AyaNova.Models public bool Hour12 { get; set; } - //relations //https://docs.microsoft.com/en-us/ef/core/modeling/relationships#other-relationship-patterns [JsonIgnore]//hide from being returned (as null anyway) in routes @@ -43,7 +42,6 @@ namespace AyaNova.Models CurrencyName = "USD"; Hour12 = true; UiColor = "#000000";//black is the default - CopyGeneralNotificationsToEmail = false; } } diff --git a/server/AyaNova/resource/de.json b/server/AyaNova/resource/de.json index e8507c02..2eed47ea 100644 --- a/server/AyaNova/resource/de.json +++ b/server/AyaNova/resource/de.json @@ -1902,6 +1902,5 @@ "ConnectionSecurity": "SMTP-Verbindungssicherheit", "SmtpServerPort": "SMTP-Server-Port", "NotifyFromAddress": "SMTP-Benachrichtigungsadresse", - "AyaNovaServerURL": "AyaNova Server URL", - "CopyGeneralNotificationsToEmail":"Senden Sie eine Kopie der allgemeinen Benachrichtigungen an die E-Mail-Adresse" + "AyaNovaServerURL": "AyaNova Server URL" } \ No newline at end of file diff --git a/server/AyaNova/resource/en.json b/server/AyaNova/resource/en.json index 04889664..ef105e94 100644 --- a/server/AyaNova/resource/en.json +++ b/server/AyaNova/resource/en.json @@ -1902,6 +1902,5 @@ "ConnectionSecurity": "SMTP connection security", "SmtpServerPort": "SMTP server port", "NotifyFromAddress": "SMTP notify from address", - "AyaNovaServerURL": "AyaNova server URL", - "CopyGeneralNotificationsToEmail":"Send a copy of general notifications via email" + "AyaNovaServerURL": "AyaNova server URL" } \ No newline at end of file diff --git a/server/AyaNova/resource/es.json b/server/AyaNova/resource/es.json index 00e90d0b..af3ef6ea 100644 --- a/server/AyaNova/resource/es.json +++ b/server/AyaNova/resource/es.json @@ -1902,6 +1902,5 @@ "ConnectionSecurity": "Seguridad de conexión del servidor SMTP", "SmtpServerPort": "Puerto SMTP", "NotifyFromAddress": "Notificación SMTP desde la dirección", - "AyaNovaServerURL": "URL del servidor AyaNova", - "CopyGeneralNotificationsToEmail":"Enviar una copia de las notificaciones generales a la dirección de correo electrónico" + "AyaNovaServerURL": "URL del servidor AyaNova" } \ No newline at end of file diff --git a/server/AyaNova/resource/fr.json b/server/AyaNova/resource/fr.json index ddd531c3..bd3d16f4 100644 --- a/server/AyaNova/resource/fr.json +++ b/server/AyaNova/resource/fr.json @@ -1902,6 +1902,5 @@ "ConnectionSecurity": "Sécurité de la connexion SMTP", "SmtpServerPort": "Port du serveur SMTP", "NotifyFromAddress": "Notification SMTP envoyée depuis l'adresse", - "AyaNovaServerURL": "URL du serveur AyaNova", - "CopyGeneralNotificationsToEmail": "Envoyer une copie des notifications générales à l'adresse e-mail" + "AyaNovaServerURL": "URL du serveur AyaNova" } \ No newline at end of file diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 8a0fa34e..53785b45 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -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 = 12; - internal const long EXPECTED_COLUMN_COUNT = 384; + internal const long EXPECTED_COLUMN_COUNT = 383; internal const long EXPECTED_INDEX_COUNT = 139; //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! @@ -338,7 +338,7 @@ $BODY$; //Add user options table await ExecQueryAsync("CREATE TABLE auseroptions (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + "userid bigint not null, translationid bigint not null REFERENCES atranslation (id), languageoverride text, timezoneoverride text, "+ - "currencyname text, hour12 bool not null, emailaddress text, copygeneralnotificationstoemail bool not null uicolor varchar(12) not null default '#000000')"); + "currencyname text, hour12 bool not null, emailaddress text, uicolor varchar(12) not null default '#000000')"); //Prime the db with the default SuperUser account