From d58ede8fd33e3430a6031affd825b80b7c7d5793 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 8 Oct 2018 18:24:55 +0000 Subject: [PATCH] --- devdocs/todo.txt | 17 ----------------- server/AyaNova/Controllers/WidgetController.cs | 8 ++++---- 2 files changed, 4 insertions(+), 21 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index 98768361..f7ecc874 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -29,23 +29,6 @@ IMMEDIATE ITEMS: ================ - - - EventLogProcessor.AddEntry: CHANGE this to save the context itself and then change all callers to handle that (remove save) - - I originally didn't have the save in there because I thought subsequent code might all share in the single context save, - however that's impossible as things like the search indexing require a save to harvest id's so it's not actually saving any time just adding complexity - where it shouldn't (in the caller) - - Why does user create entries in the biz object but Widget does it in the controller? - Determine which is "canon" and change the other. Must be consistent unless absolutely needs not to be. - - - REFACTOR: can biz objects or controllers be improved to contain the type and then all code within then use that central type for consistency? - - Anything else that can be improved? The indexing code is all identical mostly with the exception of the actual fields, maybe it can be formalized and moved up or down a level? - - If it's because it needs to be called directly, then maybe have the controller call the biz object to do the indexing so that it's clear what is happening? - - Or move it to the biz object entirely?? Seems maybe logical since it's not really a controller issue. - - Delete children in User object: I don't like it this way, the children would all be common to another biz object so instead I would like to see it call the other object, not directly issue sql changes - (right now the user deletes the tag maps directly, this is just wrong) - - NAMING is it dbObj, o, inObj? Go through and consistivize - - Widgetcontroller and UserController POST, move check for authorized rights into biz object - - Auto visible id number assigning code - Give widgets a visible ID number scheme and add to tests - Ensure search code process keywords includes the Visible ID value andadd test for that in Search indexing tests diff --git a/server/AyaNova/Controllers/WidgetController.cs b/server/AyaNova/Controllers/WidgetController.cs index 0ea9a363..4b32b444 100644 --- a/server/AyaNova/Controllers/WidgetController.cs +++ b/server/AyaNova/Controllers/WidgetController.cs @@ -291,14 +291,14 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext); - var dbObj = await biz.GetNoLogAsync(id); - if (dbObj == null) + var o = await biz.GetNoLogAsync(id); + if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); - if (!Authorized.IsAuthorizedToDelete(HttpContext.Items, biz.BizType, dbObj.OwnerId)) + if (!Authorized.IsAuthorizedToDelete(HttpContext.Items, biz.BizType, o.OwnerId)) return StatusCode(401, new ApiNotAuthorizedResponse()); - if (!biz.Delete(dbObj)) + if (!biz.Delete(o)) return BadRequest(new ApiErrorResponse(biz.Errors)); return NoContent();