From c1784f85ae9b249b95d58e5262a2ac0447720efd Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 9 Jul 2020 23:28:13 +0000 Subject: [PATCH] --- devdocs/specs/core-notification.txt | 14 +++++++----- server/AyaNova/biz/NotifyMailSecurity.cs | 21 ++++++++++++++++++ .../models/GlobalOpsNotificationSettings.cs | 22 +++++++++++++++++++ server/AyaNova/util/AySchema.cs | 3 +++ 4 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 server/AyaNova/biz/NotifyMailSecurity.cs create mode 100644 server/AyaNova/models/GlobalOpsNotificationSettings.cs diff --git a/devdocs/specs/core-notification.txt b/devdocs/specs/core-notification.txt index a9608c6c..aaa15a7d 100644 --- a/devdocs/specs/core-notification.txt +++ b/devdocs/specs/core-notification.txt @@ -21,12 +21,14 @@ BACKEND TODO / SYSTEM FOR RAVEN -TODO: need a utility that can hash any adhoc collection of fields to work with various notify related objects - (NOT RELIABLE UNFORTUNATELY, JUST CHECK MULTIPLE FIELDS INSTEAD) -TODO: Never creates a duplicate APP or EMAIL notify, so checks in history log before sending -TODO: HASH (NOT RELIABLE UNFORTUNATELY, JUST CHECK MULTIPLE FIELDS INSTEAD) uniquely identifies a notification delivery and it's logged with the history so before a new delivery is sent it's compared to the delivery log and if it was sent - in the last 90 days then it skips it. This will avoid duplicated emails or runaway notifies etc. - Hash needs to be unique to the destination user, teh source object and the event type exactly, if there is any difference then it should not hash the same +TODO: check before any thing that might create a dupe +todo: have removed the old v7 SMTP retry deliveries for simplification + instead, it will now act as if this is always set to true + Probe email server first if can't contact then skip smtp delivers (same as v7 when this setting true) + New: will make every effort to err on the side of assuming delivery happened in any issue during delivery + This will be one way to ensure it doesn't pile on the emails because of some spurious issue that actually delivered but it seemed like it might not have + User will be able to go into notifyevent table adn remove any items they don't want delivered in case of issue + TODO: import v7 needs to create users for each contact and set their default for deliveries of notifications based on old region and send notification setting Make a case for this and or implement it with this work so it doesn't get lost diff --git a/server/AyaNova/biz/NotifyMailSecurity.cs b/server/AyaNova/biz/NotifyMailSecurity.cs new file mode 100644 index 00000000..e0c3d09d --- /dev/null +++ b/server/AyaNova/biz/NotifyMailSecurity.cs @@ -0,0 +1,21 @@ +namespace AyaNova.Biz +{ + + + /// + /// All AyaNova smtp notification connection security + /// + /// + public enum NotifyMailSecurity : int + { + + None = 0, + StartTls = 1, + SSLTLS=3 + + //NEW ITEMS REQUIRE translation KEYS + + } + + +}//eons diff --git a/server/AyaNova/models/GlobalOpsNotificationSettings.cs b/server/AyaNova/models/GlobalOpsNotificationSettings.cs new file mode 100644 index 00000000..44cdfc0c --- /dev/null +++ b/server/AyaNova/models/GlobalOpsNotificationSettings.cs @@ -0,0 +1,22 @@ +using System; +using AyaNova.Biz; +namespace AyaNova.Models +{ + + public class GlobalOpsNotificationSettings + { + public long Id { get; set; }//this is always 1 as there is only ever one single global Ops object + public uint Concurrency { get; set; } + public bool Active { get; set; } + public string SmtpServerAddress { get; set; } + public string SmtpAccount { get; set; } + public string SmtpPassword { get; set; } + public NotifyMailSecurity ConnectionSecurity { get; set; } + public int SmtpServerPort { get; set; } + public string NotifyFromAddress { get; set; } + public GlobalOpsNotificationSettings() + { + Active = true; + } + } +} diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 3a4005be..c6ad287b 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -236,6 +236,9 @@ namespace AyaNova.Util await ExecQueryAsync("CREATE TABLE aglobalopsbackupsettings (id integer NOT NULL PRIMARY KEY, active bool not null, " + "backuptime timestamp, backupsetstokeep int, backupattachments bool)"); + await ExecQueryAsync("CREATE TABLE aglobalopsnotificationsettings (id integer NOT NULL PRIMARY KEY, active bool not null, " + + "backuptime timestamp, backupsetstokeep int, backupattachments bool)"); + //create aevent biz event log table await ExecQueryAsync("CREATE TABLE aevent (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, created timestamp not null, userid bigint not null," + "ayid bigint not null, ayatype integer not null, ayevent integer not null, textra varchar(255))");