This commit is contained in:
2020-12-30 22:40:15 +00:00
parent 59470c5626
commit fedccfc48b
2 changed files with 52 additions and 5 deletions

View File

@@ -15,7 +15,7 @@ namespace AyaNova.Models
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; }
@@ -23,15 +23,59 @@ namespace AyaNova.Models
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
[Required]
public string Number { get; set; }
public long? VendorId { get; set; }
public string UPC { get; set; }
public bool LifeTimeWarranty { get; set; }
public DateTime? IntroducedDate { get; set; }
public bool Discontinued { get; set; }
public DateTime? DiscontinuedDate { get; set; }
public int? WarrantyLength { get; set; }
public string WarrantyTerms { get; set; }
public UnitModel()
{
Tags = new List<string>();
Tags = new List<string>();
}
[NotMapped, JsonIgnore]
public AyaType AyaType { get => AyaType.UnitModel; }
[JsonIgnore]//hide from being returned (as null anyway) with User object in routes
public Vendor Vendor { get; set; }
}//eoc
}//eons
/*
CREATE TABLE [dbo].[AUNITMODEL](
[AID] [uniqueidentifier] NOT NULL,
[ANOTES] [ntext] NULL,
[ACREATED] [datetime] NOT NULL,
[AMODIFIED] [datetime] NOT NULL,
[AACTIVE] [bit] NOT NULL,
[ACREATOR] [uniqueidentifier] NOT NULL,
[AMODIFIER] [uniqueidentifier] NOT NULL,
[ANAME] [nvarchar](255) NULL,
[AMODELNUMBER] [nvarchar](255) NULL,
[AVENDORID] [uniqueidentifier] NULL,
[AUPC] [nvarchar](255) NULL,
[AUNITMODELCATEGORYID] [uniqueidentifier] NULL,//TAG
[ALIFETIMEWARRANTY] [bit] NOT NULL,
[AINTRODUCEDDATE] [datetime] NULL,
[ADISCONTINUED] [bit] NOT NULL,
[ADISCONTINUEDDATE] [datetime] NULL,
[AWARRANTYLENGTH] [int] NULL,
[AWARRANTYTERMS] [nvarchar](255) NULL,
[ACUSTOM1] [ntext] NULL,
[ACUSTOM2] [ntext] NULL,
[ACUSTOM3] [ntext] NULL,
[ACUSTOM4] [ntext] NULL,
[ACUSTOM5] [ntext] NULL,
[ACUSTOM6] [ntext] NULL,
[ACUSTOM7] [ntext] NULL,
[ACUSTOM8] [ntext] NULL,
[ACUSTOM9] [ntext] NULL,
[ACUSTOM0] [ntext] NULL,
*/

View File

@@ -358,7 +358,7 @@ BEGIN
when 29 then aytable = 'aquotetemplate';
when 30 then aytable = 'aquotetemplateitem';
when 31 then aytable = 'aunit';
when 32 then aytable = 'aunitmodel';
when 32 then aytable = 'aunitmodel'; aynamecolumn = 'number';
when 33 then aytable = 'avendor';
when 34 then aytable = 'aworkorder'; aynamecolumn ='serial';
when 35 then return 'LT:WorkOrderItem';
@@ -712,8 +712,11 @@ $BODY$ LANGUAGE PLPGSQL STABLE");
await ExecQueryAsync("CREATE INDEX aunit_tags ON aunit using GIN(tags)");
//UNITMODEL
await ExecQueryAsync("CREATE TABLE aunitmodel (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 )");
await ExecQueryAsync("CREATE TABLE aunitmodel (id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY, name text null, active bool, " +
"notes text, wiki text, customfields text, tags varchar(255) ARRAY, "+
"number text not null, vendorid bigint null references avendor(id), upc text null, lifetimewarranty bool not null, introduceddate timestamp null, " +
"discontinued bool not null, discontinueddate timestamp null, warrantylength integer null, warrantyterms text 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)");