This commit is contained in:
2020-05-04 21:12:38 +00:00
parent f3e0a1d0e3
commit 4cf69b0bc3
5 changed files with 74 additions and 27 deletions

View File

@@ -1,33 +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 partial class PM
{
public long Id { get; set; }
public uint ConcurrencyToken { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki {get;set;}
public uint Serial { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
//dependents
public List<PMItem> PMItems { get; set; }
public PM()
{
Tags = new List<string>();
PMItems = new List<PMItem>();
}
//Not persisted business properties
//NOTE: this could be a common class applied to everything for common biz rule stuff
//i.e. specific rights in situations based on rules, like candelete, canedit etc
[NotMapped]
public bool NonDataBaseExampleColumn { get; set; }//example of how to add a property that is not persisted but is used by both ends dynamically, should come up with a naming scheme so can see them at a glance
}//eoc
}//eons

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
@@ -22,12 +21,25 @@ namespace AyaNova.Models
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
//Principle
[Required]//this required annotation should cause a cascade delete to happen automatically when wo is deleted, need to test that
public long PMId { get; set; }//fk
public PM PM { get; set; }
//Dependents
public PMItem()
{
Tags = new List<string>();
}
//Not persisted business properties
//NOTE: this could be a common class applied to everything for common biz rule stuff
//i.e. specific rights in situations based on rules, like candelete, canedit etc
[NotMapped]
public bool NonDataBaseExampleColumn { get; set; }//example of how to add a property that is not persisted but is used by both ends dynamically, should come up with a naming scheme so can see them at a glance
}//eoc
}//eons

View File

@@ -1,33 +1,44 @@
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 partial class Quote
{
public long Id { get; set; }
public uint ConcurrencyToken { get; set; }
[Required]
public string Name { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki {get;set;}
public uint Serial { get; set; }
public bool Active { get; set; }
public string Notes { get; set; }
public string Wiki { get; set; }
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
//dependents
public List<QuoteItem> QuoteItems { get; set; }
public Quote()
{
Tags = new List<string>();
QuoteItems = new List<QuoteItem>();
}
//Not persisted business properties
//NOTE: this could be a common class applied to everything for common biz rule stuff
//i.e. specific rights in situations based on rules, like candelete, canedit etc
[NotMapped]
public bool NonDataBaseExampleColumn { get; set; }//example of how to add a property that is not persisted but is used by both ends dynamically, should come up with a naming scheme so can see them at a glance
}//eoc
}//eons

View File

@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using AyaNova.Biz;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
namespace AyaNova.Models
@@ -22,12 +21,25 @@ namespace AyaNova.Models
public string CustomFields { get; set; }
public List<string> Tags { get; set; }
//Principle
[Required]//this required annotation should cause a cascade delete to happen automatically when wo is deleted, need to test that
public long QuoteId { get; set; }//fk
public Quote Quote { get; set; }
//Dependents
public QuoteItem()
{
Tags = new List<string>();
}
//Not persisted business properties
//NOTE: this could be a common class applied to everything for common biz rule stuff
//i.e. specific rights in situations based on rules, like candelete, canedit etc
[NotMapped]
public bool NonDataBaseExampleColumn { get; set; }//example of how to add a property that is not persisted but is used by both ends dynamically, should come up with a naming scheme so can see them at a glance
}//eoc
}//eons

View File

@@ -385,7 +385,7 @@ namespace AyaNova.Util
//WORKORDER
await ExecQueryAsync("CREATE TABLE aworkorder (id BIGSERIAL PRIMARY KEY, serial bigint not null, active bool, " +
"notes text NULL, wiki text null, customfields text NULL, tags varchar(255) ARRAY NULL)");
await ExecQueryAsync("CREATE INDEX aworkorder_number_id_idx ON aworkorder (id, serial);");
await ExecQueryAsync("CREATE INDEX aworkorder_serial_id_idx ON aworkorder (id, serial);");//is this necessary or fruitful?
await ExecQueryAsync("CREATE INDEX aworkorder_tags ON aworkorder using GIN(tags)");
//WORKORDERITEM
@@ -407,13 +407,13 @@ namespace AyaNova.Util
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, " +
await ExecQueryAsync("CREATE TABLE aquote (id BIGSERIAL PRIMARY KEY, serial bigint not null, 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 UNIQUE INDEX aquote_serial_id_idx ON aquote (id, serial);");//is this necessary or fruitful?
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, " +
await ExecQueryAsync("CREATE TABLE aquoteitem (id BIGSERIAL PRIMARY KEY, quoteid bigint not null REFERENCES aquote (id), 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)");
@@ -431,13 +431,13 @@ namespace AyaNova.Util
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, " +
await ExecQueryAsync("CREATE TABLE apm (id BIGSERIAL PRIMARY KEY, serial bigint not null, 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 UNIQUE INDEX apm_serial_id_idx ON apm (id, serial);");//is this necessary or fruitful?
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, " +
await ExecQueryAsync("CREATE TABLE apmitem (id BIGSERIAL PRIMARY KEY, pmid bigint not null REFERENCES apm (id), 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)");