From 894b06c5eccf2805f9c64c8ff3ba398d4bbcc473 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 1 May 2020 21:26:10 +0000 Subject: [PATCH] STUB remaining v7 corebizobjects --- server/AyaNova/biz/Search.cs | 2 +- server/AyaNova/biz/TagUtil.cs | 2 +- server/AyaNova/util/AySchema.cs | 128 +++++++++++++++++++++++++++++++- 3 files changed, 128 insertions(+), 4 deletions(-) diff --git a/server/AyaNova/biz/Search.cs b/server/AyaNova/biz/Search.cs index 26528e81..bdaaafa6 100644 --- a/server/AyaNova/biz/Search.cs +++ b/server/AyaNova/biz/Search.cs @@ -236,7 +236,7 @@ namespace AyaNova.Biz MatchingObjects = MatchingObjects.Take(searchParameters.MaxResults).ToList(); //Sort and group the matching objects list in return order - //Customer.OrderBy(c => c.LastName).ThenBy(c => c.FirstName) + //zCzustomer.OrderBy(c => c.LastName).ThenBy(c => c.FirstName) var OrderedMatchingObjects = MatchingObjects.OrderBy(x => x.ObjectType).ThenByDescending(x => x.ObjectId); diff --git a/server/AyaNova/biz/TagUtil.cs b/server/AyaNova/biz/TagUtil.cs index 0640a8d9..9f7d4105 100644 --- a/server/AyaNova/biz/TagUtil.cs +++ b/server/AyaNova/biz/TagUtil.cs @@ -28,7 +28,7 @@ namespace AyaNova.Biz public static string NormalizeTag(string inObj) { //Must be lowercase per rules - //This may be naive when we get international customers but for now supporting utf-8 and it appears it's safe to do this with unicode + //This may be naive when we get international cust omers but for now supporting utf-8 and it appears it's safe to do this with unicode inObj = inObj.ToLowerInvariant(); //No spaces in tags, replace with dashes inObj = inObj.Replace(" ", "-"); diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index b9cca572..043a4e26 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -316,7 +316,7 @@ namespace AyaNova.Util -////////////////////////////////////////////////// + ////////////////////////////////////////////////// //MULTIPLE BIZ OBJECT tables if (currentSchema < 11) { @@ -324,14 +324,138 @@ namespace AyaNova.Util //CUSTOMER await ExecQueryAsync("CREATE TABLE acustomer (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + - "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); await ExecQueryAsync("CREATE UNIQUE INDEX acustomer_name_id_idx ON acustomer (id, name);"); await ExecQueryAsync("CREATE INDEX acustomer_tags ON acustomer using GIN(tags)"); + //CONTRACT + await ExecQueryAsync("CREATE TABLE acontract (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX acontract_name_id_idx ON acontract (id, name);"); + await ExecQueryAsync("CREATE INDEX acontract_tags ON acontract using GIN(tags)"); + //HEADOFFICE + await ExecQueryAsync("CREATE TABLE aheadoffice (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aheadoffice_name_id_idx ON aheadoffice (id, name);"); + await ExecQueryAsync("CREATE INDEX aheadoffice_tags ON aheadoffice using GIN(tags)"); + //LOANUNIT + await ExecQueryAsync("CREATE TABLE aloanunit (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aloanunit_name_id_idx ON aloanunit (id, name);"); + await ExecQueryAsync("CREATE INDEX aloanunit_tags ON aloanunit using GIN(tags)"); + //PART + await ExecQueryAsync("CREATE TABLE apart (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX apart_name_id_idx ON apart (id, name);"); + await ExecQueryAsync("CREATE INDEX apart_tags ON apart using GIN(tags)"); + + //PROJECT + await ExecQueryAsync("CREATE TABLE aproject (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aproject_name_id_idx ON aproject (id, name);"); + await ExecQueryAsync("CREATE INDEX aproject_tags ON aproject using GIN(tags)"); + + //PURCHASEORDER + await ExecQueryAsync("CREATE TABLE apurchaseorder (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX apurchaseorder_name_id_idx ON apurchaseorder (id, name);"); + await ExecQueryAsync("CREATE INDEX apurchaseorder_tags ON apurchaseorder using GIN(tags)"); + + //UNIT + await ExecQueryAsync("CREATE TABLE aunit (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aunit_name_id_idx ON aunit (id, name);"); + await ExecQueryAsync("CREATE INDEX aunit_tags ON aunit using GIN(tags)"); + + //UNITMODEL + await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aunitmodel_name_id_idx ON aunitmodel (id, name);"); + await ExecQueryAsync("CREATE INDEX aunitmodel_tags ON aunitmodel using GIN(tags)"); + + //VENDOR + await ExecQueryAsync("CREATE TABLE avendor (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX avendor_name_id_idx ON avendor (id, name);"); + await ExecQueryAsync("CREATE INDEX avendor_tags ON avendor using GIN(tags)"); + + //WORKORDER + await ExecQueryAsync("CREATE TABLE aworkorder (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aworkorder_name_id_idx ON aworkorder (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorder_tags ON aworkorder using GIN(tags)"); + + //WORKORDERITEM + await ExecQueryAsync("CREATE TABLE aworkorderitem (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aworkorderitem_name_id_idx ON aworkorderitem (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkorderitem_tags ON aworkorderitem using GIN(tags)"); + + //WORKORDERTEMPLATE + await ExecQueryAsync("CREATE TABLE aworkordertemplate (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aworkordertemplate_name_id_idx ON aworkordertemplate (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkordertemplate_tags ON aworkordertemplate using GIN(tags)"); + + //WORKORDERTEMPLATEITEM + await ExecQueryAsync("CREATE TABLE aworkordertemplateitem (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aworkordertemplateitem_name_id_idx ON aworkordertemplateitem (id, name);"); + await ExecQueryAsync("CREATE INDEX aworkordertemplateitem_tags ON aworkordertemplateitem using GIN(tags)"); + + //QUOTE + await ExecQueryAsync("CREATE TABLE aquote (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aquote_name_id_idx ON aquote (id, name);"); + await ExecQueryAsync("CREATE INDEX aquote_tags ON aquote using GIN(tags)"); + + //QUOTEITEM + await ExecQueryAsync("CREATE TABLE aquoteitem (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aquoteitem_name_id_idx ON aquoteitem (id, name);"); + await ExecQueryAsync("CREATE INDEX aquoteitem_tags ON aquoteitem using GIN(tags)"); + + //QUOTETEMPLATE + await ExecQueryAsync("CREATE TABLE aquotetemplate (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aquotetemplate_name_id_idx ON aquotetemplate (id, name);"); + await ExecQueryAsync("CREATE INDEX aquotetemplate_tags ON aquotetemplate using GIN(tags)"); + + //QUOTETEMPLATEITEM + await ExecQueryAsync("CREATE TABLE aquotetemplateitem (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX aquotetemplateitem_name_id_idx ON aquotetemplateitem (id, name);"); + await ExecQueryAsync("CREATE INDEX aquotetemplateitem_tags ON aquotetemplateitem using GIN(tags)"); + + //PM + await ExecQueryAsync("CREATE TABLE apm (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX apm_name_id_idx ON apm (id, name);"); + await ExecQueryAsync("CREATE INDEX apm_tags ON apm using GIN(tags)"); + + //PMITEM + await ExecQueryAsync("CREATE TABLE apmitem (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX apmitem_name_id_idx ON apmitem (id, name);"); + await ExecQueryAsync("CREATE INDEX apmitem_tags ON apmitem using GIN(tags)"); + + //PMTEMPLATE + await ExecQueryAsync("CREATE TABLE apmtemplate (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX apmtemplate_name_id_idx ON apmtemplate (id, name);"); + await ExecQueryAsync("CREATE INDEX apmtemplate_tags ON apmtemplate using GIN(tags)"); + + //PMTEMPLATEITEM + await ExecQueryAsync("CREATE TABLE apmtemplateitem (id BIGSERIAL PRIMARY KEY, name varchar(255) not null unique, active bool, " + + "notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)"); + await ExecQueryAsync("CREATE UNIQUE INDEX apmtemplateitem_name_id_idx ON apmtemplateitem (id, name);"); + await ExecQueryAsync("CREATE INDEX apmtemplateitem_tags ON apmtemplateitem using GIN(tags)"); + + await SetSchemaLevelAsync(++currentSchema); }