From e33c94bf24c3da2f0ece08fc4c1a3fa0bc4bd5ec Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 25 Mar 2021 20:42:48 +0000 Subject: [PATCH] --- server/AyaNova/models/WorkOrderItem.cs | 23 +++++---- .../AyaNova/models/WorkOrderItemPriority.cs | 34 +++++++++++++ server/AyaNova/models/WorkOrderItemStatus.cs | 50 +++++++++++++++++++ server/AyaNova/models/WorkOrderStatus.cs | 3 -- server/AyaNova/util/AySchema.cs | 37 ++++++++++---- 5 files changed, 126 insertions(+), 21 deletions(-) create mode 100644 server/AyaNova/models/WorkOrderItemPriority.cs create mode 100644 server/AyaNova/models/WorkOrderItemStatus.cs diff --git a/server/AyaNova/models/WorkOrderItem.cs b/server/AyaNova/models/WorkOrderItem.cs index 76dac93c..33c892ac 100644 --- a/server/AyaNova/models/WorkOrderItem.cs +++ b/server/AyaNova/models/WorkOrderItem.cs @@ -1,3 +1,4 @@ +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; @@ -10,20 +11,24 @@ namespace AyaNova.Models public class WorkOrderItem : ICoreBizObjectModel { - + public long Id { get; set; } public uint Concurrency { get; set; } public string Notes { get; set; }//Was Summary public string Wiki { get; set; } public string CustomFields { get; set; } public List Tags { get; set; } = new List(); - -public string TechNotes { get; set; } - - - //Principle + [Required] public long WorkOrderId { get; set; } + public string TechNotes { get; set; } + public long WorkorderItemStatusId { get; set; } + public long WorkorderItemPriorityId { get; set; } + public DateTime RequestDate { get; set; } + public bool WarrantyService { get; set; } = false; + + //Principle + [JsonIgnore] public WorkOrder WorkOrder { get; set; } @@ -59,9 +64,9 @@ CREATE TABLE [dbo].[AWORKORDERITEM]( [APRIORITYID] [uniqueidentifier] NULL, [AREQUESTDATE] [datetime] NULL, [ASUMMARY] [nvarchar](255) NULL,//Now Notes - [ATYPEID] [uniqueidentifier] NULL, - [AUNITID] [uniqueidentifier] NULL, - [AWORKORDERITEMUNITSERVICETYPEID] [uniqueidentifier] NULL, + [ATYPEID] [uniqueidentifier] NULL,//Now a tag + [AUNITID] [uniqueidentifier] NULL,//MOVED TO WOITEMUNITS COLLECTION + [AWORKORDERITEMUNITSERVICETYPEID] [uniqueidentifier] NULL,//MOVE TO WOITEMUNITS COLLECTION? [AWARRANTYSERVICE] [bit] NOT NULL, [ACUSTOM1] [ntext] NULL, [ACUSTOM2] [ntext] NULL, diff --git a/server/AyaNova/models/WorkOrderItemPriority.cs b/server/AyaNova/models/WorkOrderItemPriority.cs new file mode 100644 index 00000000..f50ac3f4 --- /dev/null +++ b/server/AyaNova/models/WorkOrderItemPriority.cs @@ -0,0 +1,34 @@ +using AyaNova.Biz; +using System.ComponentModel.DataAnnotations; +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 WorkOrderItemPriority + { + public long Id { get; set; } + public uint Concurrency { get; set; } + + [Required] + public string Name { get; set; } + public bool Active { get; set; } + [MaxLength(12)] + public string Color { get; set; } = "#ffffff";//white / no color is the default + + }//eoc + +}//eons +/* + [dbo].[APRIORITY]( + [AID] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NOT NULL, + [ACREATOR] [uniqueidentifier] NOT NULL, + [AMODIFIER] [uniqueidentifier] NOT NULL, + [ANAME] [nvarchar](255) NOT NULL, + [AMODIFIED] [datetime] NOT NULL, + [AARGB] [int] NOT NULL, + [AACTIVE] [bit] NOT NULL, + */ \ No newline at end of file diff --git a/server/AyaNova/models/WorkOrderItemStatus.cs b/server/AyaNova/models/WorkOrderItemStatus.cs new file mode 100644 index 00000000..73e4b1c3 --- /dev/null +++ b/server/AyaNova/models/WorkOrderItemStatus.cs @@ -0,0 +1,50 @@ +using AyaNova.Biz; +using System.ComponentModel.DataAnnotations; +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 WorkOrderItemStatus + { + public long Id { get; set; } + public uint Concurrency { get; set; } + + [Required] + public string Name { get; set; } + public bool Active { get; set; } + public string Notes { get; set; } + + /* + Hexadecimal notation: #RGB[A] + R (red), G (green), B (blue), and A (alpha) are hexadecimal characters (0–9, A–F). A is optional. The three-digit notation (#RGB) is a shorter version of the six-digit form (#RRGGBB). For example, #f09 is the same color as #ff0099. Likewise, the four-digit RGB notation (#RGBA) is a shorter version of the eight-digit form (#RRGGBBAA). For example, #0f38 is the same color as #00ff3388. + */ + [MaxLength(12)] + public string Color { get; set; } + + + public WorkOrderItemStatus() + { + Color = "#ffffff";//white / no color is the default + } + + }//eoc + +}//eons +/* + [dbo].[AWORKORDERSTATUS]( + [AID] [uniqueidentifier] NOT NULL, + [ACREATED] [datetime] NOT NULL, + [AMODIFIED] [datetime] NOT NULL, + [AACTIVE] [bit] NOT NULL, + [ACREATOR] [uniqueidentifier] NOT NULL, + [AMODIFIER] [uniqueidentifier] NOT NULL, + [ANAME] [nvarchar](255) NOT NULL, + [ADESCRIPTION] [nvarchar](255) NULL, + [AARGB] [int] NOT NULL + + + V8: Split from workorder status for v8, for item it's still a single value and migrate should bring over all into both workorderstatus and this workorderitemstatus +*/ \ No newline at end of file diff --git a/server/AyaNova/models/WorkOrderStatus.cs b/server/AyaNova/models/WorkOrderStatus.cs index 1814e898..edcb5f6c 100644 --- a/server/AyaNova/models/WorkOrderStatus.cs +++ b/server/AyaNova/models/WorkOrderStatus.cs @@ -1,8 +1,5 @@ -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 aacf33e2..595df5c9 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -458,9 +458,9 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //Prime the db with the default SuperUser account await AyaNova.Biz.PrimeData.PrimeSuperUserAccount(ct); - + //Add user table - await ExecQueryAsync("CREATE TABLE alicense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, dbid TEXT, key TEXT NOT NULL)"); + await ExecQueryAsync("CREATE TABLE alicense (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, dbid TEXT, key TEXT NOT NULL)"); //Add widget table //id, TEXT, longtext, boolean, currency, @@ -483,21 +483,21 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); await ExecQueryAsync("CREATE TABLE aopsjob (gid uuid PRIMARY KEY, name TEXT NOT NULL, created TIMESTAMP NOT NULL, exclusive BOOL NOT NULL, " + "startafter TIMESTAMP NOT NULL, jobtype INTEGER NOT NULL, subtype INTEGER, objectid BIGINT, atype INTEGER, jobstatus INTEGER NOT NULL, jobinfo TEXT)"); await ExecQueryAsync("CREATE TABLE aopsjoblog (gid uuid PRIMARY KEY, jobid uuid NOT NULL, created TIMESTAMP NOT NULL, statustext TEXT NOT NULL)"); - + await ExecQueryAsync("CREATE TABLE adatalistsavedfilter (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL, name TEXT NOT NULL, public BOOL NOT NULL, " + "defaultfilter BOOL NOT NULL, listkey VARCHAR(255) NOT NULL, filter TEXT)"); await ExecQueryAsync("CREATE TABLE adatalistcolumnview (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, userid BIGINT NOT NULL, " + "listkey VARCHAR(255) NOT NULL, columns TEXT, sort TEXT)"); - + await ExecQueryAsync("CREATE TABLE atag (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, refcount BIGINT NOT NULL)"); - + await ExecQueryAsync("CREATE TABLE aformcustom (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, " + "formkey VARCHAR(255) NOT NULL, template TEXT, UNIQUE(formkey))"); - + await ExecQueryAsync("CREATE TABLE apicklisttemplate (id INTEGER NOT NULL PRIMARY KEY, " + "template TEXT)"); - + //SERVICERATE await ExecQueryAsync("CREATE TABLE aservicerate (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY, " @@ -727,9 +727,27 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + ")"); //---------- + + /* + ██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗██████╗ + ██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝ ██╔═══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗ + ██║ █╗ ██║██║ ██║██████╔╝█████╔╝█████╗██║ ██║██████╔╝██║ ██║█████╗ ██████╔╝ + ██║███╗██║██║ ██║██╔══██╗██╔═██╗╚════╝██║ ██║██╔══██╗██║ ██║██╔══╝ ██╔══██╗ + ╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗ ╚██████╔╝██║ ██║██████╔╝███████╗██║ ██║ + ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝ + */ //WORKORDER STATUS await ExecQueryAsync("CREATE TABLE aworkorderstatus (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + "notes TEXT, color VARCHAR(12) NOT NULL default '#000000', selectroles INTEGER NOT NULL, removeroles INTEGER NOT NULL, completed BOOL NOT NULL, locked BOOL NOT NULL)"); + + //WORKORDERITEM STATUS + await ExecQueryAsync("CREATE TABLE aworkorderitemstatus (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + + "notes TEXT, color VARCHAR(12) NOT NULL default '#000000')"); + + //WORKORDERITEM PRIORITY + await ExecQueryAsync("CREATE TABLE aworkorderitempriority (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name TEXT NOT NULL UNIQUE, active BOOL NOT NULL, " + + "color VARCHAR(12) NOT NULL default '#000000')"); + //WORKORDER await ExecQueryAsync("CREATE TABLE aworkorder (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, serial BIGINT GENERATED BY DEFAULT AS IDENTITY NOT NULL, active BOOL NOT NULL, " @@ -743,6 +761,7 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "workorderstatusid BIGINT NOT NULL REFERENCES aworkorderstatus (id), created TIMESTAMP NOT NULL, userid BIGINT NOT NULL REFERENCES auser (id)" + ")"); +here await ExecQueryAsync("CREATE TABLE aworkorderitem (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, workorderid BIGINT NOT NULL REFERENCES aworkorder (id), " + "notes TEXT, wiki TEXT, customfields TEXT, tags VARCHAR(255) ARRAY )"); @@ -895,10 +914,10 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); + "notes TEXT, roles INTEGER NOT NULL, atype INTEGER NOT NULL, template TEXT, style TEXT, jsprerender TEXT, jshelpers TEXT, rendertype INTEGER NOT NULL, " + "headertemplate TEXT, footertemplate TEXT, displayheaderfooter BOOL, paperformat INTEGER NOT NULL, landscape BOOL, marginoptionsbottom TEXT, " + "marginoptionsleft TEXT, marginoptionsright TEXT, marginoptionstop TEXT, pageranges TEXT, prefercsspagesize BOOL, printbackground BOOL, scale DECIMAL(8,5) )"); - + //Load the stock REPORT TEMPLATES await AyaNova.Biz.PrimeData.PrimeReportTemplates(); - + //DASHBOARD 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);