diff --git a/server/AyaNova/biz/AyaObjectOwnerId.cs b/server/AyaNova/biz/AyaObjectOwnerId.cs deleted file mode 100644 index 986870b1..00000000 --- a/server/AyaNova/biz/AyaObjectOwnerId.cs +++ /dev/null @@ -1,48 +0,0 @@ -// using AyaNova.Models; -// using AyaNova.Biz; - -// using Microsoft.EntityFrameworkCore; -// using Microsoft.EntityFrameworkCore.Metadata; -// using System.Reflection; -// using System; - - -// namespace AyaNova.Biz -// { - -// /// -// /// Returns owner Id if the object exists or 0 if exists but there is no owner ID property or -1 if the object doesn't exist -// /// -// internal static class AyaObjectOwnerId -// { -// internal static long Get(AyaTypeId o, AyContext ct) -// { -// if (o.IsEmpty) return -1; - - -// //Get the type of the model of AyaObject -// Type t = Type.GetType("AyaNova.Models." + o.ObjectType.ToString()); - -// //Run a find query on the db context based on the model's type -// object record = ct.Find(t, o.ObjectId); -// if (record == null) -// { -// return -1; -// } - - -// PropertyInfo ownerIdPropertyInfo = record.GetType().GetProperty("OwnerId"); - -// if (ownerIdPropertyInfo == null) -// return 0;//object exists and it doesn't have an ownerID property - - -// long ret = (long)ownerIdPropertyInfo.GetValue(record, null); - -// return ret; - -// } - -// } - -// }//eons diff --git a/server/AyaNova/biz/AyaTypeId.cs b/server/AyaNova/biz/AyaTypeId.cs index a6a7aa8c..31149928 100644 --- a/server/AyaNova/biz/AyaTypeId.cs +++ b/server/AyaNova/biz/AyaTypeId.cs @@ -71,15 +71,7 @@ namespace AyaNova.Biz } } - // /// - // /// Get the ownerId for the object in question - // /// - // /// db context - // /// 0 if object doesn't have an owner Id, the owner Id or -1 if the object doesn't exist in the db - // public long OwnerId(AyContext ct) - // { - // return AyaObjectOwnerId.Get(this, ct); - // } + /// diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index eaf3691f..aeb4298a 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -85,8 +85,7 @@ namespace AyaNova.Biz { //do stuff with widget Widget outObj = inObj; - outObj.OwnerId = UserId; - + //Test get serial id visible id number from generator outObj.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext(); @@ -114,7 +113,7 @@ namespace AyaNova.Biz { //do stuff with widget Widget outObj = inObj; - outObj.OwnerId = UserId; + //Test get serial id visible id number from generator outObj.Serial = ServerBootConfig.WIDGET_SERIAL.GetNext(); outObj.Tags = TagUtil.NormalizeTags(outObj.Tags); @@ -140,10 +139,7 @@ namespace AyaNova.Biz //put internal bool Put(Widget dbObj, Widget inObj) { - //preserve the owner ID if none was specified - if (inObj.OwnerId == 0) - inObj.OwnerId = dbObj.OwnerId; - + //make a snapshot of the original for validation but update the original to preserve workflow Widget SnapshotOfOriginalDBObj = new Widget(); CopyObject.Copy(dbObj, SnapshotOfOriginalDBObj); @@ -355,13 +351,7 @@ namespace AyaNova.Biz // // } // } - //OwnerId required - if (!isNew) - { - if (proposedObj.OwnerId == 0) - AddError(ApiErrorCode.VALIDATION_REQUIRED, "OwnerId"); - } - + //Name required if (string.IsNullOrWhiteSpace(proposedObj.Name)) AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name"); diff --git a/server/AyaNova/models/Widget.cs b/server/AyaNova/models/Widget.cs index 70476821..191fbef3 100644 --- a/server/AyaNova/models/Widget.cs +++ b/server/AyaNova/models/Widget.cs @@ -13,8 +13,7 @@ namespace AyaNova.Models public long Id { get; set; } public uint ConcurrencyToken { get; set; } - [Required] - public long OwnerId { get; set; } + [Required] public string Name { get; set; } public uint Serial { get; set; } public decimal? DollarAmount { get; set; } diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index 464adbe1..3803cb33 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -205,7 +205,7 @@ namespace AyaNova.Util //Add widget table //id, text, longtext, boolean, currency, - exec("CREATE TABLE awidget (id BIGSERIAL PRIMARY KEY, ownerid bigint not null, name varchar(255) not null, serial bigint not null," + + exec("CREATE TABLE awidget (id BIGSERIAL PRIMARY KEY, name varchar(255) not null, serial bigint not null," + "startdate timestamp, enddate timestamp, dollaramount decimal(19,5), active bool, roles int4, count integer, notes text, customfields text, tags varchar(255) ARRAY)"); //TEST TEST TEST ONLY FOR DEVELOPMENT TESTING TO ENSURE UNIQUENESS diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index 100fcda6..b8a4a651 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -462,8 +462,7 @@ namespace AyaNova.Util o.Active = true; o.StartDate = f.Date.Between(DateTime.Now, DateTime.Now.AddMinutes(60)); o.EndDate = f.Date.Between(DateTime.Now.AddMinutes(90), DateTime.Now.AddHours(5)); - o.DollarAmount = Convert.ToDecimal(f.Commerce.Price()); - o.OwnerId = 1; + o.DollarAmount = Convert.ToDecimal(f.Commerce.Price()); //this is nonsense but just to test an enum o.Roles = AuthorizationRoles.DispatchLimited | AuthorizationRoles.InventoryLimited | AuthorizationRoles.OpsAdminLimited; o.Notes = f.Lorem.Paragraph();