From 7afb5777351cab79a79e9982eef059b7de535b8d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 4 Jan 2019 20:01:34 +0000 Subject: [PATCH] --- devdocs/todo.txt | 75 ++++++++++++------- .../Controllers/UserOptionsController.cs | 10 +-- server/AyaNova/Startup.cs | 4 +- 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/devdocs/todo.txt b/devdocs/todo.txt index f08f54a7..1946516d 100644 --- a/devdocs/todo.txt +++ b/devdocs/todo.txt @@ -5,6 +5,7 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQ0NTU5NzAwIiwiZXhwIjoi ## IMMEDIATE ITEMS + Need a sprint to get to a fully testable client with entry form, list and as much as possible all features from COMMON-* specs list ----------------------- @@ -12,34 +13,17 @@ Need a sprint to get to a fully testable client with entry form, list and as muc /// TODO CLIENT STUFF - - Client: initialize after login sets locale formats for everything. - - First it gets useroptions to know what to override or not, then sets defaults based on browser or override settings in central client area for all display/parsing etc - - - SERVER CHANGE: USEROPTIONS SETTINGS NEEDED: - - Will need currency symbol, date format, numeric format from user settings at server - - - Allow a choice: browser native display format or forced format set in useroptions - - Code the client so it will do either one from a setting fetched off the server for a session - - - THESE SETTINGS NEEDED FOR USEROPTIONS - - Use browser TimeZone - - Use this timezoneoffset (already have this) - - Use browser Numeric format - - Override browser with these numeric format settings instead (see below) - - Digit grouping symbol i.e. the , in 1,000,000 - - Decimal symbol i.e. the . in 1.00 - - Currency symbol string (may be more than one character in some locales i.e. "Eur") - - negative display format one of these: -1.1, (1.1), 1.1- - - Use browser Datetime format - - Override browser datetime with these settings instead (see below) - - One single date format string? Or one for time, one for date and one for date/time? (see v7) - - Take from day.js (https://github.com/iamkun/dayjs/blob/master/docs/en/API-reference.md#list-of-all-available-formats) - - Do not allow anything other than numeric display, i.e. no January or Saturday so we avoid localization issues - - - + - Error handling: + - Serious fundamental errors with no data return from the server like no connection should be handled at a lower level but + - Any API error (or good data) object returned from the server should be treated like any data returned and sent up the line so caller can handle it + - e.g. an input form needs the validation error object to handle shit + - Error messages: ensure error messages that come back from API that start with LT: will be localized correctly before display / logging (may need string interpolation too for some in future, consider that) - + - Client api calls should go through as few different objects as possible + - Make a function for each call type (GET, POST ETC) that in turn calls a more generic version with options as applicable + - ideally distill this down to a single or very few actual methods that do the call + - Make it a single include for all api related stuff + - LIST - Overall list menu toolbar at top with following icons: - Add new item @@ -55,6 +39,7 @@ TODO CLIENT STUFF - Login needs to scroll higher or logo smaller on sm so that the keyboard doesn't obscure the login lines - Need a test user that has access to every possible role so that I can see all the roles for testing purposes - About page has too big of margins on each side of display + - View log page has log in a small window with scroll bars instead of full screen - numeric inputs need to be set as such so that the number keyboard appears - Make the copyright banner at bottom left aligned, right now it seems weird in small iPhone size when it breaks to two lines (make text smaller?) - Change server api page favicon to look like a SERVER version of the AyaNova logo, not the same one as the client uses [ fuck it, why? TTM!] @@ -85,9 +70,45 @@ TODO CLIENT STUFF - Each item can be edited if they have the rights or viewed etc by opening into crud component - List should remember where the user was when they go to edit and back again - What to do if they edit? Refresh the list but keep the same page location? + + + - Widget crud component that works with real data - Dirty form check and prevent route leave: https://router.vuejs.org/guide/advanced/navigation-guards.html#in-component-guards - broken rule display + - IN CONJUNCTION WITH BELOW AFTER FORM IS MADE USING DEFAULTS OF CLIENT: + - All numeric and date displays and input in locale format + + - Client: initialize after login sets locale formats for everything. + - Best to do this useroptions stuff after a form is in place that I can play with at the client and experiment to see what is possible + - How much flexibility do we have to set things like numeric / currency input / display format? + - First it gets useroptions to know what to override or not, then sets defaults based on browser or override settings in central client area for all display/parsing etc + + - SERVER CHANGE: USEROPTIONS SETTINGS NEEDED: + - Best to do this useroptions stuff after a form is in place that I can play with at the client and experiment to see what is possible + - Will need currency symbol, date format, numeric format from user settings at server + + - Allow a choice: browser native display format or forced format set in useroptions + - Code the client so it will do either one from a setting fetched off the server for a session + + - THESE SETTINGS NEEDED FOR USEROPTIONS + - Use browser TimeZone + - Use this timezoneoffset (already have this) + - Use browser Numeric format + - Override browser with these numeric format settings instead (see below) + - Digit grouping symbol i.e. the , in 1,000,000 + - Decimal symbol i.e. the . in 1.00 + - Currency symbol string (may be more than one character in some locales i.e. "Eur") + - negative display format one of these: -1.1, (1.1), 1.1- + - Use browser Datetime format + - Override browser datetime with these settings instead (see below) + - One single date format string? Or one for time, one for date and one for date/time? (see v7) + - Take from day.js (https://github.com/iamkun/dayjs/blob/master/docs/en/API-reference.md#list-of-all-available-formats) + - Do not allow anything other than numeric display, i.e. no January or Saturday so we avoid localization issues + + + + diff --git a/server/AyaNova/Controllers/UserOptionsController.cs b/server/AyaNova/Controllers/UserOptionsController.cs index b5a3a777..9136fb4f 100644 --- a/server/AyaNova/Controllers/UserOptionsController.cs +++ b/server/AyaNova/Controllers/UserOptionsController.cs @@ -60,6 +60,11 @@ namespace AyaNova.Api.Controllers return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); } + if (!ModelState.IsValid) + { + return BadRequest(new ApiErrorResponse(ModelState)); + } + var UserId = UserIdFromContext.Id(HttpContext.Items); //Different than normal here: a user is *always* allowed to retrieve their own user options object @@ -68,11 +73,6 @@ namespace AyaNova.Api.Controllers return StatusCode(401, new ApiNotAuthorizedResponse()); } - if (!ModelState.IsValid) - { - return BadRequest(new ApiErrorResponse(ModelState)); - } - //Instantiate the business object handler UserOptionsBiz biz = new UserOptionsBiz(ct, UserId, UserRolesFromContext.Roles(HttpContext.Items)); diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index be7b3b5e..b3c5e844 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -380,7 +380,7 @@ namespace AyaNova // ******************** TESTING WIPE DB ***************************** // //Set this to true to wipe the db and reinstall a trial license and re-seed the data - var TESTING_REFRESH_DB = true;//####################################################################################### + var TESTING_REFRESH_DB = false;//####################################################################################### #if (DEBUG) //TESTING @@ -438,7 +438,7 @@ namespace AyaNova { context.Request.Path = "/index.html"; context.Response.StatusCode = 200; - context.Response.ContentType = "text/html"; + context.Response.ContentType = "text/html"; await context.Response.SendFileAsync(Path.Combine(env.WebRootPath, "index.html")); } });