From 80fa611acef27462737b9764e041df2e916451d1 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 5 Jan 2021 16:09:44 +0000 Subject: [PATCH] --- server/AyaNova/biz/LoanUnitRateUnit.cs | 14 +++++++++++++ server/AyaNova/models/LoanUnit.cs | 21 +++++++++++++++++++ server/AyaNova/util/AySchema.cs | 29 +++++++++++++++++++++++++- 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 server/AyaNova/biz/LoanUnitRateUnit.cs diff --git a/server/AyaNova/biz/LoanUnitRateUnit.cs b/server/AyaNova/biz/LoanUnitRateUnit.cs new file mode 100644 index 00000000..54eaa581 --- /dev/null +++ b/server/AyaNova/biz/LoanUnitRateUnit.cs @@ -0,0 +1,14 @@ +namespace AyaNova.Biz +{ + + public enum LoanUnitRateUnit : int + { + None = 0, + Hours = 1, + HalfDays = 2, + Days = 3, + Weeks = 4, + Months = 5, + Years = 6 + } +}//eons \ No newline at end of file diff --git a/server/AyaNova/models/LoanUnit.cs b/server/AyaNova/models/LoanUnit.cs index cb6d5d3c..eb842c9d 100644 --- a/server/AyaNova/models/LoanUnit.cs +++ b/server/AyaNova/models/LoanUnit.cs @@ -23,10 +23,31 @@ namespace AyaNova.Models public string CustomFields { get; set; } public List Tags { get; set; } + public string Serial { get; set; } + public long? WorkOrderItemLoanId { get; set; }//deliberately named for efcore relationship magic + + [Required] + public decimal RateHour { get; set; } + [Required] + public decimal RateHalfDay { get; set; } + [Required] + public decimal RateDay { get; set; } + [Required] + public decimal RateWeek { get; set; } + [Required] + public decimal RateMonth { get; set; } + [Required] + public decimal RateYear { get; set; } + + [Required] + public LoanUnitRateUnit DefaultRate { get; set; } + public long? UnitId { get; set; }//deliberately named for efcore relationship magic Shadow unit + public LoanUnit() { Tags = new List(); + DefaultRate = LoanUnitRateUnit.Days; } [NotMapped, JsonIgnore] diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 543a17d9..9bb462fc 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -680,10 +680,37 @@ $BODY$ LANGUAGE PLPGSQL STABLE"); //LOANUNIT await ExecQueryAsync("CREATE TABLE aloanunit (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 )"); + "notes text, wiki text, customfields text, tags varchar(255) ARRAY " + + "serial text, workorderitemloanid null references aworkorderitemloan(id), ratehour decimal(19,4) not null, " + + "ratehour decimal(19,4) not null, ratehour decimal(19,4) not null, ratehour decimal(19,4) not null, ratehour decimal(19,4) not null, ratehour decimal(19,4) not 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)"); + + // public string Serial { get; set; } + // public long? WorkOrderItemLoanId { get; set; }//deliberately named for efcore relationship magic + + // [Required] + // public decimal RateHour { get; set; } + // [Required] + // public decimal RateHalfDay { get; set; } + // [Required] + // public decimal RateDay { get; set; } + // [Required] + // public decimal RateWeek { get; set; } + // [Required] + // public decimal RateMonth { get; set; } + // [Required] + // public decimal RateYear { get; set; } + + // [Required] + // public LoanUnitRateUnit DefaultRate { get; set; } + // public long? UnitId { get; set; }//deliberately named for efcore relationship magic Shadow unit + + + //PART await ExecQueryAsync("CREATE TABLE apart (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 )");