diff --git a/server/AyaNova/generator/CoreJobNotify.cs b/server/AyaNova/generator/CoreJobNotify.cs index a1b38bf5..84f69c2d 100644 --- a/server/AyaNova/generator/CoreJobNotify.cs +++ b/server/AyaNova/generator/CoreJobNotify.cs @@ -359,7 +359,7 @@ namespace AyaNova.Biz var pdfDate=new DateTime().ToShortDateString(); var pdfTime=new DateTime().ToShortTimeString(); - reportRequest.ClientMeta = JToken.Parse($"{{'UserName':'AyaNova SuperUser','Authorization':'Bearer {jwt}','TimeZoneName':'America/Los_Angeles','LanguageName':'en-US','Hour12':true,'CurrencyName':'USD','DefaultLocale':'en','PDFDate':'{pdfDate}','PDFTime':'{pdfTime}'}}"); + reportRequest.ClientMeta = JToken.Parse($"{{'UserName':'-','Authorization':'Bearer {jwt}','TimeZoneName':'America/Los_Angeles','LanguageName':'en-US','Hour12':true,'CurrencyName':'USD','DefaultLocale':'en','PDFDate':'{pdfDate}','PDFTime':'{pdfTime}'}}"); //get port number var match = System.Text.RegularExpressions.Regex.Match(ServerBootConfig.AYANOVA_USE_URLS, "[0-9]+"); var API_URL = $"http://127.0.0.1:{match.Value}/api/{AyaNovaVersion.CurrentApiVersion}/"; diff --git a/server/AyaNova/models/CustomerNotifySubscription.cs b/server/AyaNova/models/CustomerNotifySubscription.cs index d9f092ad..02894077 100644 --- a/server/AyaNova/models/CustomerNotifySubscription.cs +++ b/server/AyaNova/models/CustomerNotifySubscription.cs @@ -6,14 +6,26 @@ using Newtonsoft.Json; namespace AyaNova.Models { - + public class CustomerNotifySubscription { public long Id { get; set; } public uint Concurrency { get; set; } + + [Required] + public long TranslationId { get; set; } + [Required] + public string LanguageOverride { get; set; } + [Required] + public string TimeZoneOverride { get; set; } + [Required] + public string CurrencyName { get; set; } + [Required] + public bool Hour12 { get; set; } + public List CustomerTags { get; set; }//Tags to match customer with this notification - public TimeSpan AdvanceNotice { get; set; } + public TimeSpan AdvanceNotice { get; set; } public long? LinkReportId { get; set; } //CREATE NOTIFY EVENT CONDITIONS - Following fields are all conditions set on whether to create a notify event or not @@ -37,6 +49,7 @@ namespace AyaNova.Models AgeValue = TimeSpan.Zero; AdvanceNotice = TimeSpan.Zero; LinkReportId = 0; + } }//eoc diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 07fcc2d9..7102622c 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -22,17 +22,16 @@ namespace AyaNova.Util //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! private const int DESIRED_SCHEMA_LEVEL = 1; - internal const long EXPECTED_COLUMN_COUNT = 1336; + internal const long EXPECTED_COLUMN_COUNT = 1341; internal const long EXPECTED_INDEX_COUNT = 154; - internal const long EXPECTED_CHECK_CONSTRAINTS = 527; - internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 198; + internal const long EXPECTED_CHECK_CONSTRAINTS = 532; + internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 199; internal const long EXPECTED_VIEWS = 11; internal const long EXPECTED_ROUTINES = 2; //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImportingAsync WHEN NEW TABLES ADDED!!!! - ///////////////////////////////////////// (C1336:I154:CC527:FC198:V11:R2 - + ///////////////////////////////////////// C1341:I154:CC532:FC199:V11:R2) /* @@ -1184,8 +1183,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //VIEWWORKORDER - adds AGE expression column for datalist queries //do *not* use the postgre AGE function, it's not intended for code use: https://github.com/npgsql/efcore.pg/issues/2157 - // await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, AGE(timezone('UTC', now()), aworkorder.createddate) as expwoage from aworkorder"); - await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, now() - aworkorder.createddate as expwoage from aworkorder"); + // await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, AGE(timezone('UTC', now()), aworkorder.createddate) as expwoage from aworkorder"); + await ExecQueryAsync("CREATE VIEW viewworkorder AS select aworkorder.*, now() - aworkorder.createddate as expwoage from aworkorder"); //NOTIFICATION await ExecQueryAsync("CREATE TABLE anotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " @@ -1207,7 +1206,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //CUSTOMER "proxy" NOTIFICATION - await ExecQueryAsync("CREATE TABLE acustomernotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + await ExecQueryAsync("CREATE TABLE acustomernotifysubscription (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + + "translationid BIGINT NOT NULL REFERENCES atranslation (id) NOT NULL, languageoverride TEXT NOT NULL, timezoneoverride TEXT NOT NULL, " + + "currencyname TEXT NOT NULL, hour12 BOOL NOT NULL, " + "customertags VARCHAR(255) ARRAY, ayatype INTEGER NOT NULL, eventtype INTEGER NOT NULL, advancenotice INTERVAL NOT NULL, " + "idvalue BIGINT NOT NULL, decvalue DECIMAL(38,18) NOT NULL, agevalue INTERVAL NOT NULL, " + "linkreportid BIGINT, tags VARCHAR(255) ARRAY)"); @@ -1215,6 +1216,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + //UNITMETERREADING await ExecQueryAsync("CREATE TABLE aunitmeterreading (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, meterdate TIMESTAMPTZ NOT NULL, notes TEXT, " + "meter BIGINT NOT NULL, unitid BIGINT NOT NULL REFERENCES aunit(id) ON DELETE CASCADE, workorderitemunitid BIGINT REFERENCES aworkorderitemunit(id) ON DELETE SET NULL)");