From 991cf7222d3e543c3eb30b0007e5a8c19b4e6dad Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 18 Aug 2021 18:02:13 +0000 Subject: [PATCH] --- .vscode/launch.json | 2 +- server/AyaNova/models/UnitMeterReading.cs | 45 +++++++++++++++++++++++ server/AyaNova/util/AySchema.cs | 17 ++++++--- 3 files changed, 57 insertions(+), 7 deletions(-) create mode 100644 server/AyaNova/models/UnitMeterReading.cs diff --git a/.vscode/launch.json b/.vscode/launch.json index b77f3b95..fcc80a75 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/UnitMeterReading.cs b/server/AyaNova/models/UnitMeterReading.cs new file mode 100644 index 00000000..bf512003 --- /dev/null +++ b/server/AyaNova/models/UnitMeterReading.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using AyaNova.Biz; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; +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 UnitMeterReading + { + public long Id { get; set; } + public uint Concurrency { get; set; } + public string Description { get; set; } + public long Meter { get; set; } + public DateTime MeterDate { get; set; } + public long UnitId { get; set; } + public long? WorkOrderItemId { get; set; } + + public UnitMeterReading() + { + + } + + + + }//eoc + +}//eons +/* + CREATE TABLE [dbo].[AUNITMETERREADING]( + [AID] [uniqueidentifier] NOT NULL, + [ADESCRIPTION] [nvarchar](255) NULL, + [ACREATED] [datetime] NOT NULL, + [AMODIFIED] [datetime] NOT NULL, + [ACREATOR] [uniqueidentifier] NOT NULL, + [AMODIFIER] [uniqueidentifier] NOT NULL, + [AMETER] [bigint] NULL, + [AMETERDATE] [datetime] NULL, + [AUNITID] [uniqueidentifier] NULL, + [AWORKORDERITEMID] [uniqueidentifier] NULL, +*/ \ No newline at end of file diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 6f3c7f59..f7f3ba73 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -22,16 +22,16 @@ namespace AyaNova.Util //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! private const int DESIRED_SCHEMA_LEVEL = 1; - internal const long EXPECTED_COLUMN_COUNT = 1220; - internal const long EXPECTED_INDEX_COUNT = 145; - internal const long EXPECTED_CHECK_CONSTRAINTS = 513; - internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 189; + internal const long EXPECTED_COLUMN_COUNT = 1226; + internal const long EXPECTED_INDEX_COUNT = 146; + internal const long EXPECTED_CHECK_CONSTRAINTS = 517; + internal const long EXPECTED_FOREIGN_KEY_CONSTRAINTS = 191; internal const long EXPECTED_VIEWS = 7; internal const long EXPECTED_ROUTINES = 2; //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! - ///////////////////////////////////////////////////////////////// C1220:I145:CC513:FC189:V7:R2 + ///////////////////////////////////////////////////////////////// (C1226:I146:CC517:FC191:V7:R2) /* @@ -1082,7 +1082,8 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "SentDate TIMESTAMP, etadate TIMESTAMP, returndate TIMESTAMP" + ")"); - + //########################################################################################################### + /////////////////////////////////////////////////////////////////////////////////////////////////////////////// //CUSTOMERSERVICEREQUEST await ExecQueryAsync("CREATE TABLE acustomerservicerequest (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL, " @@ -1117,6 +1118,10 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE anotifydeliverylog (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, processed TIMESTAMP NOT NULL, " + "objectid BIGINT NOT NULL, notifysubscriptionid BIGINT NOT NULL, fail BOOL NOT NULL, error TEXT)"); + //UNITMETERREADING + await ExecQueryAsync("CREATE TABLE aunitmeterreading (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, meterdate TIMESTAMP NOT NULL, description TEXT, " + + "meter BIGINT NOT NULL, unitid BIGINT NOT NULL REFERENCES aunit(id) ON DELETE CASCADE, workorderitemid BIGINT REFERENCES aworkorderitem(id) ON DELETE SET NULL)"); + //LOGO await ExecQueryAsync("CREATE TABLE alogo (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + "large bytea, largetype TEXT, medium bytea, mediumtype TEXT, small bytea, smalltype TEXT)");