diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index 043d4662..8e137a57 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -489,6 +489,9 @@ namespace AyaNova _newLog.LogDebug("Global settings"); ServerGlobalBizSettings.Initialize(null, dbContext); + _newLog.LogDebug("Ops settings"); + ServerGlobalOpsSettings.Initialize(null, dbContext); + //Ensure translations are present, not missing any keys and that there is a server default translation that exists TranslationBiz lb = new TranslationBiz(dbContext, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.OpsAdminFull); lb.ValidateTranslationsAsync().Wait(); diff --git a/server/AyaNova/models/GlobalOpsSettings.cs b/server/AyaNova/models/GlobalOpsSettings.cs index db9eff16..e382fee0 100644 --- a/server/AyaNova/models/GlobalOpsSettings.cs +++ b/server/AyaNova/models/GlobalOpsSettings.cs @@ -1,5 +1,4 @@ -using System.ComponentModel.DataAnnotations; -using Newtonsoft.Json; +using System; namespace AyaNova.Models { @@ -8,15 +7,18 @@ namespace AyaNova.Models public long Id { get; set; }//this is always 1 as there is only ever one single global Ops object public uint Concurrency { get; set; } - //Global settings - //Picklist and other searches override the normal case insensitive value - //this is precautionarily added for non latinate languages where it could be an issue - public bool SearchCaseSensitiveOnly {get;set;} + public DateTime BackupTime { get; set; } + public DateTime LastBackup { get; set; } + public int BackupSetsToKeep { get; set; } + public bool BackupAttachments { get; set; } public GlobalOpsSettings() - { - Id=1;//always 1 - SearchCaseSensitiveOnly = false; + { + Id = 1;//always 1 + BackupTime = new DateTime(2020, 5, 19, 23, 59, 0, DateTimeKind.Utc);//date doesn't matter it only uses hour + LastBackup = DateTime.MinValue; + BackupSetsToKeep = 3; + } } } diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index bb5de7d4..b809d221 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -142,6 +142,10 @@ namespace AyaNova.Util await ExecQueryAsync("CREATE TABLE aglobalbizsettings (id integer NOT NULL PRIMARY KEY, " + "searchcasesensitiveonly bool default false)"); + //create global ops settings table + await ExecQueryAsync("CREATE TABLE aglobalopssettings (id integer NOT NULL PRIMARY KEY, " + + "backuptime timestamp, lastbackup 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))");