From 32e9650061ec8f8caa696dcd462a4d7d8bbae6bf Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 20 May 2019 21:50:19 +0000 Subject: [PATCH] --- devdocs/todo.txt | 4 ++-- server/AyaNova/biz/FormCustomBiz.cs | 22 +++------------------- server/AyaNova/models/FormCustom.cs | 3 --- server/AyaNova/util/AySchema.cs | 2 +- 4 files changed, 6 insertions(+), 25 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index a7f78d00..12033270 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -15,12 +15,12 @@ Remove OwnerId - DONE UserOptions remove but also has a bit below - DONE ValidateJsonPatch - DONE FileAttachment + - DONE FormCustom - Rename OwnerId to UserId for those objects that require it still - - DataFilter + - DONE DataFilter - EventLog - Event object uses it see eventlog above - - FormCustom uses it much like DataFilter does, could also be renamed to UserId and semantically be better - UserOptions (rename to userID) - OpsJob (might be removable, rename it CreatorID? Or, if it's already logged in the event log then maybe no creator ID is required at all.) diff --git a/server/AyaNova/biz/FormCustomBiz.cs b/server/AyaNova/biz/FormCustomBiz.cs index a17c6a8b..08bc7c4c 100644 --- a/server/AyaNova/biz/FormCustomBiz.cs +++ b/server/AyaNova/biz/FormCustomBiz.cs @@ -59,11 +59,9 @@ namespace AyaNova.Biz return null; else { - //do stuff with datafilter + //do stuff with object FormCustom outObj = inObj; - outObj.OwnerId = UserId; - - + await ct.FormCustom.AddAsync(outObj); await ct.SaveChangesAsync(); @@ -104,10 +102,7 @@ namespace AyaNova.Biz //put internal bool Put(FormCustom dbObj, FormCustom inObj) { - //preserve the owner ID if none was specified - if (inObj.OwnerId == 0) - inObj.OwnerId = dbObj.OwnerId; - + //Replace the db object with the PUT object CopyObject.Copy(inObj, dbObj, "Id"); //Set "original" value of concurrency token to input token @@ -138,17 +133,6 @@ namespace AyaNova.Biz private void Validate(FormCustom inObj, bool isNew) { - //OwnerId required - if (!isNew) - { - if (inObj.OwnerId == 0) - AddError(ApiErrorCode.VALIDATION_REQUIRED, "OwnerId"); - } - - // //Owner must be current user, there are no exceptions - // if (inObj.OwnerId != UserId) - // AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "OwnerId", "OwnerId must be current user Id"); - //FormKey required and must be valid if (string.IsNullOrWhiteSpace(inObj.FormKey)) AddError(ApiErrorCode.VALIDATION_REQUIRED, "FormKey"); diff --git a/server/AyaNova/models/FormCustom.cs b/server/AyaNova/models/FormCustom.cs index 41305f0a..72c3d436 100644 --- a/server/AyaNova/models/FormCustom.cs +++ b/server/AyaNova/models/FormCustom.cs @@ -22,9 +22,6 @@ namespace AyaNova.Models { public long Id { get; set; } public uint ConcurrencyToken { get; set; } - - [Required] - public long OwnerId { get; set; } [Required, MaxLength(255)] public string FormKey { get; set; }//max 255 characters ascii set diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index f35852e8..87723f5e 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -285,7 +285,7 @@ namespace AyaNova.Util { LogUpdateMessage(log); - exec("CREATE TABLE aformcustom (id BIGSERIAL PRIMARY KEY, ownerid bigint not null, " + + exec("CREATE TABLE aformcustom (id BIGSERIAL PRIMARY KEY, " + "formkey varchar(255) not null, template text, UNIQUE(formkey))"); setSchemaLevel(++currentSchema); }