From b5a8179c42d1423a55bec280f4e877bd9efc9cbf Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 12 Mar 2020 23:16:19 +0000 Subject: [PATCH] --- server/AyaNova/Controllers/PickListController.cs | 10 +++++----- server/AyaNova/PickList/PickListFactory.cs | 16 ++++++++++++---- server/AyaNova/biz/BizRoles.cs | 11 ++++++----- server/AyaNova/biz/PickListBiz.cs | 8 ++++---- server/AyaNova/util/AySchema.cs | 6 +++--- 5 files changed, 30 insertions(+), 21 deletions(-) diff --git a/server/AyaNova/Controllers/PickListController.cs b/server/AyaNova/Controllers/PickListController.cs index 487c0638..29a9c8ad 100644 --- a/server/AyaNova/Controllers/PickListController.cs +++ b/server/AyaNova/Controllers/PickListController.cs @@ -82,9 +82,9 @@ namespace AyaNova.Api.Controllers /// /// List of strings [HttpGet("TemplateList")] - public async Task GetTemplateList() + public ActionResult GetTemplateList() { - if (!serverState.IsOpen) + if (!serverState.IsOpen) { return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); } @@ -92,15 +92,15 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler PickListBiz biz = PickListBiz.GetBiz(ct, HttpContext); - - var o = await biz.GetListOfAllPickListKeyNames(); + long TranslationId = UserTranslationIdFromContext.Id(HttpContext.Items); + var o = biz.GetListOfAllPickListTypes(TranslationId); if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); return Ok(ApiOkResponse.Response(o, true)); - + } diff --git a/server/AyaNova/PickList/PickListFactory.cs b/server/AyaNova/PickList/PickListFactory.cs index 89ca31d3..ba4f3a5e 100644 --- a/server/AyaNova/PickList/PickListFactory.cs +++ b/server/AyaNova/PickList/PickListFactory.cs @@ -21,19 +21,27 @@ namespace AyaNova.PickList } //List all the PickList-able object types available - internal static List GetListOfAllPickListKeyNames() - { - + internal static List GetListOfAllPickListTypes(long TranslationId) + { + List TranslationKeysToFetch = new List(); List ret = new List(); var values = System.Enum.GetValues(typeof(AyaType)); foreach (AyaType t in values) { if (t.HasAttribute(typeof(CoreBizObjectAttribute))) { - ret.Add(new NameIdItem() { Name = t.ToString(), Id = (long)t }); + var name = t.ToString(); + TranslationKeysToFetch.Add(name); + ret.Add(new NameIdItem() { Name = name, Id = (long)t }); } } + + var LT = TranslationBiz.GetSubsetStaticAsync(TranslationKeysToFetch, TranslationId).Result; + foreach (NameIdItem i in ret) + { + i.Name = LT[i.Name]; + } return ret; } diff --git a/server/AyaNova/biz/BizRoles.cs b/server/AyaNova/biz/BizRoles.cs index 9255cf99..b430e9bd 100644 --- a/server/AyaNova/biz/BizRoles.cs +++ b/server/AyaNova/biz/BizRoles.cs @@ -180,15 +180,16 @@ namespace AyaNova.Biz //############## Uncomment SerializeObject line, put a break on lastRoles, copy from the output in the LOG (good for javascript with quotes formatted that way) ####### // #### NEED to separately take a copy and update "lastRoles" string here by copying from the variable watch for the "json" variable shown in the debugger because need the C# format escaped quotes string - // //GENERATE JSON FROM ROLES OUTPUT TO DEBUG LOG IN JAVASCRIPT COMPATIBLE FORMAT + // // //GENERATE JSON FROM ROLES OUTPUT TO DEBUG LOG IN JAVASCRIPT COMPATIBLE FORMAT // string json = Newtonsoft.Json.JsonConvert.SerializeObject(roles, Newtonsoft.Json.Formatting.None); - // //Output roles JSON FRAGMENT string for CLIENT to log + // // //Output roles JSON FRAGMENT string for CLIENT to log // System.Diagnostics.Debugger.Log(1, "JSONFRAGMENTFORCLIENT", "BizRoles.cs -> biz-role-rights.js Client roles JSON fragment:"); // System.Diagnostics.Debugger.Log(1, "JSONFRAGMENTFORCLIENT", json); - //ONGOING VALIDATION TO CATCH MISMATCH WHEN NEW ROLES ADDED (wont' catch changes to existing unfortunately) - //var lastRoles = "{\"User\":{\"Change\":2,\"ReadFullRecord\":1},\"UserOptions\":{\"Change\":2,\"ReadFullRecord\":1},\"Widget\":{\"Change\":34,\"ReadFullRecord\":17},\"ServerState\":{\"Change\":16384,\"ReadFullRecord\":32767},\"License\":{\"Change\":16386,\"ReadFullRecord\":8193},\"LogFile\":{\"Change\":0,\"ReadFullRecord\":24576},\"JobOperations\":{\"Change\":16384,\"ReadFullRecord\":8195},\"AyaNova7Import\":{\"Change\":16384,\"ReadFullRecord\":0},\"Metrics\":{\"Change\":0,\"ReadFullRecord\":24576},\"Translation\":{\"Change\":16386,\"ReadFullRecord\":32767},\"DataListFilter\":{\"Change\":2,\"ReadFullRecord\":32767},\"FormCustom\":{\"Change\":2,\"ReadFullRecord\":32767}}"; - var lastRoles = "{\"User\":{\"Change\":2,\"ReadFullRecord\":1},\"UserOptions\":{\"Change\":2,\"ReadFullRecord\":1},\"Widget\":{\"Change\":34,\"ReadFullRecord\":17},\"ServerState\":{\"Change\":16384,\"ReadFullRecord\":131071},\"License\":{\"Change\":16386,\"ReadFullRecord\":8193},\"LogFile\":{\"Change\":0,\"ReadFullRecord\":24576},\"JobOperations\":{\"Change\":16384,\"ReadFullRecord\":8195},\"AyaNova7Import\":{\"Change\":16384,\"ReadFullRecord\":0},\"Metrics\":{\"Change\":0,\"ReadFullRecord\":24576},\"Translation\":{\"Change\":16386,\"ReadFullRecord\":131071},\"DataListView\":{\"Change\":2,\"ReadFullRecord\":131071},\"FormCustom\":{\"Change\":2,\"ReadFullRecord\":131071}}"; + //ONGOING VALIDATION TO CATCH MISMATCH WHEN NEW ROLES ADDED (wont' catch changes to existing unfortunately) + //var lastRoles = "{\"User\":{\"Change\":2,\"ReadFullRecord\":1},\"UserOptions\":{\"Change\":2,\"ReadFullRecord\":1},\"Widget\":{\"Change\":34,\"ReadFullRecord\":17},\"ServerState\":{\"Change\":16384,\"ReadFullRecord\":131071},\"License\":{\"Change\":16386,\"ReadFullRecord\":8193},\"LogFile\":{\"Change\":0,\"ReadFullRecord\":24576},\"JobOperations\":{\"Change\":16384,\"ReadFullRecord\":8195},\"AyaNova7Import\":{\"Change\":16384,\"ReadFullRecord\":0},\"Metrics\":{\"Change\":0,\"ReadFullRecord\":24576},\"Translation\":{\"Change\":16386,\"ReadFullRecord\":131071},\"DataListView\":{\"Change\":2,\"ReadFullRecord\":131071},\"FormCustom\":{\"Change\":2,\"ReadFullRecord\":131071}}"; + var lastRoles = "{\"User\":{\"Change\":2,\"ReadFullRecord\":1,\"Select\":131071},\"UserOptions\":{\"Change\":2,\"ReadFullRecord\":1,\"Select\":0},\"Widget\":{\"Change\":34,\"ReadFullRecord\":17,\"Select\":131071},\"ServerState\":{\"Change\":16384,\"ReadFullRecord\":131071,\"Select\":0},\"License\":{\"Change\":16386,\"ReadFullRecord\":8193,\"Select\":0},\"LogFile\":{\"Change\":0,\"ReadFullRecord\":24576,\"Select\":0},\"JobOperations\":{\"Change\":16384,\"ReadFullRecord\":8195,\"Select\":0},\"AyaNova7Import\":{\"Change\":16384,\"ReadFullRecord\":0,\"Select\":0},\"Metrics\":{\"Change\":0,\"ReadFullRecord\":24576,\"Select\":0},\"Translation\":{\"Change\":16386,\"ReadFullRecord\":131071,\"Select\":0},\"DataListView\":{\"Change\":2,\"ReadFullRecord\":131071,\"Select\":0},\"FormCustom\":{\"Change\":2,\"ReadFullRecord\":131071,\"Select\":0},\"PickListTemplate\":{\"Change\":2,\"ReadFullRecord\":131071,\"Select\":131071}}"; + Dictionary lastRolesDeserialized = Newtonsoft.Json.JsonConvert.DeserializeObject>(lastRoles); if (lastRolesDeserialized.Count != roles.Count) { diff --git a/server/AyaNova/biz/PickListBiz.cs b/server/AyaNova/biz/PickListBiz.cs index 8d8d0ac0..0d725811 100644 --- a/server/AyaNova/biz/PickListBiz.cs +++ b/server/AyaNova/biz/PickListBiz.cs @@ -58,16 +58,16 @@ namespace AyaNova.Biz //get picklist internal async Task> GetPickListAsync(AyaType ayaType, string query, AuthorizationRoles userRoles) { - - List items = await PickListFetcher.GetResponseAsync(ayaType, query, ct, userRoles); + + List items = await PickListFetcher.GetResponseAsync(ayaType, query, ct, userRoles); return items; } //get picklist templates, basically all the object types that support picklists - internal async Task> GetListOfAllPickListKeyNames() + internal List GetListOfAllPickListTypes(long translationId) { - return PickListFactory.GetListOfAllPickListKeyNames(); + return PickListFactory.GetListOfAllPickListTypes(translationId); // List items = await PickListFetcher.GetResponseAsync(ayaType, query, ct, UserId, userRoles); // return items; } diff --git a/server/AyaNova/util/AySchema.cs b/server/AyaNova/util/AySchema.cs index c796ac30..7afd36f9 100644 --- a/server/AyaNova/util/AySchema.cs +++ b/server/AyaNova/util/AySchema.cs @@ -20,10 +20,10 @@ namespace AyaNova.Util /////////// CHANGE THIS ON NEW SCHEMA UPDATE //////////////////// //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!! - private const int DESIRED_SCHEMA_LEVEL = 9; + private const int DESIRED_SCHEMA_LEVEL = 10; - internal const long EXPECTED_COLUMN_COUNT = 98; - internal const long EXPECTED_INDEX_COUNT = 26; + internal const long EXPECTED_COLUMN_COUNT = 100; + internal const long EXPECTED_INDEX_COUNT = 27; //!!!!WARNING: BE SURE TO UPDATE THE DbUtil::EmptyBizDataFromDatabaseForSeedingOrImporting WHEN NEW TABLES ADDED!!!!