diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e2049e9..8fd97968 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -53,7 +53,7 @@ "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", - "AYANOVA_SERVER_TEST_MODE": "false", + "AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" diff --git a/server/AyaNova/models/CustomerNote.cs b/server/AyaNova/models/CustomerNote.cs index 368beb51..ec762ed2 100644 --- a/server/AyaNova/models/CustomerNote.cs +++ b/server/AyaNova/models/CustomerNote.cs @@ -1,33 +1,38 @@ +using System; using System.Collections.Generic; +using AyaNova.Biz; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -using AyaNova.Biz; using Newtonsoft.Json; namespace AyaNova.Models { - //NOTE: Any non required field (nullable in DB) sb nullable here, i.e. decimal? not decimal, - //otherwise the server will call it an invalid record if the field isn't sent from client + public class CustomerNote : ICoreBizObjectModel { public long Id { get; set; } - public uint Concurrency { get; set; } - + public uint Concurrency { get; set; } + [Required] + public long UserId { get; set; } + [Required] public DateTime NoteDate { get; set; } - public string Notes { get; set; } public List Tags { get; set; } public CustomerNote() { + NoteDate = DateTime.UtcNow; Tags = new List(); } [NotMapped, JsonIgnore] public AyaType AyaType { get => AyaType.CustomerNote; } + [JsonIgnore]//hide from being returned (as null anyway) with User object in routes + public User User { get; set; } + }//eoc }//eons diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 42a192e8..0438a7c8 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -22,8 +22,8 @@ namespace AyaNova.Util //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! private const int DESIRED_SCHEMA_LEVEL = 15; - internal const long EXPECTED_COLUMN_COUNT = 450; - internal const long EXPECTED_INDEX_COUNT = 144; + internal const long EXPECTED_COLUMN_COUNT = 455; + internal const long EXPECTED_INDEX_COUNT = 145; //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! @@ -492,6 +492,10 @@ $BODY$; await ExecQueryAsync("ALTER TABLE auser add FOREIGN KEY (customerid) REFERENCES acustomer(id)"); + //CUSTOMER NOTES + await ExecQueryAsync("CREATE TABLE acustomernotes (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + + "userid bigint not null REFERENCES auser(id), startdate timestamp not null, notes text, tags varchar(255) ARRAY )"); + //CONTRACT await ExecQueryAsync("CREATE TABLE acontract (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text not null unique, active bool, " + "notes text, wiki text, customfields text, tags varchar(255) ARRAY )");