diff --git a/server/AyaNova/biz/UserBiz.cs b/server/AyaNova/biz/UserBiz.cs index 5f2b54a4..0161a5b9 100644 --- a/server/AyaNova/biz/UserBiz.cs +++ b/server/AyaNova/biz/UserBiz.cs @@ -357,7 +357,9 @@ namespace AyaNova.Biz //NOTIFY SUBSCRIPTIONS await ct.Database.ExecuteSqlInterpolatedAsync($"delete from anotifysubscription where userid = {dbObject.Id}"); //personal datalistview - await ct.Database.ExecuteSqlInterpolatedAsync($"delete from adatalistview where public = {false} and userid = {dbObject.Id}"); + await ct.Database.ExecuteSqlInterpolatedAsync($"delete from adatalistview where public = {false} and userid = {dbObject.Id}"); + //Dashboard view + await ct.Database.ExecuteSqlInterpolatedAsync($"delete from adashboardview where userid = {dbObject.Id}"); await EventLogProcessor.DeleteObjectLogAsync(UserId, BizType, dbObject.Id, dbObject.Name, ct); await Search.ProcessDeletedObjectKeywordsAsync(dbObject.Id, BizType, ct); diff --git a/server/AyaNova/models/AyContext.cs b/server/AyaNova/models/AyContext.cs index 1ce1dbb5..3db4fd9c 100644 --- a/server/AyaNova/models/AyContext.cs +++ b/server/AyaNova/models/AyContext.cs @@ -70,6 +70,7 @@ namespace AyaNova.Models public virtual DbSet Logo { get; set; } public virtual DbSet Report { get; set; } + public virtual DbSet DashboardView { get; set; } //Note: had to add this constructor to work with the code in startup.cs that gets the connection string from the appsettings.json file //and commented out the above on configuring diff --git a/server/AyaNova/models/DashboardView.cs b/server/AyaNova/models/DashboardView.cs new file mode 100644 index 00000000..41ce9652 --- /dev/null +++ b/server/AyaNova/models/DashboardView.cs @@ -0,0 +1,23 @@ + +using System.ComponentModel.DataAnnotations; + +namespace AyaNova.Models +{ + + public class DashboardView + { + public DashboardView(){ + View="[]";//empty view by default + } + public long Id { get; set; } + public uint Concurrency { get; set; } + + [Required] + public long UserId { get; set; } + + [Required] + public string View { get; set; }//JSON Dashboard registry view object + + + } +} diff --git a/server/AyaNova/models/Logo.cs b/server/AyaNova/models/Logo.cs index fe1e05a7..a5109003 100644 --- a/server/AyaNova/models/Logo.cs +++ b/server/AyaNova/models/Logo.cs @@ -1,10 +1,3 @@ -using System; -using System.Collections.Generic; -using AyaNova.Biz; -using System.ComponentModel.DataAnnotations; -using System.ComponentModel.DataAnnotations.Schema; -using Newtonsoft.Json; - namespace AyaNova.Models { diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index a5ea7391..7a6eddc0 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -20,10 +20,10 @@ namespace AyaNova.Util /////////// CHANGE THIS ON NEW SCHEMA UPDATE //////////////////// //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! - private const int DESIRED_SCHEMA_LEVEL = 14; + private const int DESIRED_SCHEMA_LEVEL = 15; - internal const long EXPECTED_COLUMN_COUNT = 414; - internal const long EXPECTED_INDEX_COUNT = 142; + internal const long EXPECTED_COLUMN_COUNT = 417; + internal const long EXPECTED_INDEX_COUNT = 144; //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! @@ -431,7 +431,7 @@ $BODY$; { LogUpdateMessage(log); - await ExecQueryAsync("CREATE TABLE adatalistview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userId bigint not null, name varchar(255) not null unique, public bool not null," + + await ExecQueryAsync("CREATE TABLE adatalistview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null, name varchar(255) not null unique, public bool not null," + "listkey varchar(255) not null, listview text)"); await SetSchemaLevelAsync(++currentSchema); @@ -732,19 +732,14 @@ $BODY$; await AyaNova.Biz.PrimeData.PrimeReportTemplates(); } -// public string HeaderTemplate { get; set; } -// public string FooterTemplate { get; set; } -// public bool DisplayHeaderFooter { get; set; } -// public ReportPaperFormat PaperFormat { get; set; } -// public bool Landscape { get; set; } -// public string MarginOptionsBottom { get; set; } -// public string MarginOptionsLeft { get; set; } -// public string MarginOptionsRight { get; set; } -// public string MarginOptionsTop { get; set; } -// public string PageRanges { get; set; } -// public bool PreferCSSPageSize { get; set; } -// public bool PrintBackground { get; set; } -// public decimal Scale { get; set; } + ////////////////////////////////////////////////// + //DATAFILTER / DATALISTTEMPLATE tables + if (currentSchema < 15) + { + LogUpdateMessage(log); + await ExecQueryAsync("CREATE TABLE adashboardview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid bigint not null unique, view text not null)"); + await SetSchemaLevelAsync(++currentSchema); + } //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! diff --git a/server/AyaNova/util/DbUtil.cs b/server/AyaNova/util/DbUtil.cs index 66889dce..38f8c481 100644 --- a/server/AyaNova/util/DbUtil.cs +++ b/server/AyaNova/util/DbUtil.cs @@ -284,7 +284,7 @@ namespace AyaNova.Util await cmd.ExecuteNonQueryAsync(); } - //Delete from users table + //Delete users using (var cmd = new Npgsql.NpgsqlCommand()) { cmd.Connection = conn; @@ -293,6 +293,9 @@ namespace AyaNova.Util cmd.CommandText = "ALTER SEQUENCE auser_id_seq RESTART WITH 2;"; await cmd.ExecuteNonQueryAsync(); + + cmd.CommandText = "delete from \"adashboardview\" where userid <> 1;"; + await cmd.ExecuteNonQueryAsync(); } //Delete non stock translations