From 0c06bdeef0bd0b35741d5cb9dddb5c4b8e92a9cc Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 10 Dec 2019 20:57:33 +0000 Subject: [PATCH] --- .../Controllers/FormCustomController.cs | 46 ++++++++++--------- server/AyaNova/Startup.cs | 1 + .../AyaNova/biz/FilterSqlCriteriaBuilder.cs | 3 ++ 3 files changed, 28 insertions(+), 22 deletions(-) diff --git a/server/AyaNova/Controllers/FormCustomController.cs b/server/AyaNova/Controllers/FormCustomController.cs index afd6760c..19755ae1 100644 --- a/server/AyaNova/Controllers/FormCustomController.cs +++ b/server/AyaNova/Controllers/FormCustomController.cs @@ -58,7 +58,7 @@ namespace AyaNova.Api.Controllers /// The official form key used by AyaNova /// A prior concurrency token used to check if there are any changes without using up bandwidth sending unnecessary data /// A single FormCustom or nothing and a header 304 not modified - [HttpGet("{formkey}")] + [HttpGet("{formkey}")] public async Task GetFormCustom([FromRoute] string formkey, [FromQuery] uint? concurrencyToken) { if (serverState.IsClosed) @@ -127,28 +127,30 @@ namespace AyaNova.Api.Controllers } } - // /// - // /// Get available types allowed for Custom fields - // /// Used to build UI for customizing a form - // /// - // /// Required roles: - // /// BizAdminFull only has rights to customize forms - // /// - // /// - // /// A list of type string values valid for custom fields - // [HttpGet("AvailableCustomTypes")] - // public ActionResult GetAvailableCustomTypes() - // { - // if (serverState.IsClosed) - // return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); - // if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.FormCustom)) - // return StatusCode(403, new ApiNotAuthorizedResponse()); - // if (!ModelState.IsValid) - // return BadRequest(new ApiErrorResponse(ModelState)); - // return Ok(ApiOkResponse.Response(CustomFieldType.ValidCustomFieldTypes, true)); - // } + /// + /// Get available types allowed for Custom fields + /// Used to build UI for customizing a form + /// + /// Required roles: + /// BizAdminFull only has rights to customize forms + /// + /// + /// A list of type string values valid for custom fields + [HttpGet("AvailableCustomTypes")] + public ActionResult GetAvailableCustomTypes() + { + if (serverState.IsClosed) + return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); + + if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.FormCustom)) + return StatusCode(403, new ApiNotAuthorizedResponse()); + + if (!ModelState.IsValid) + return BadRequest(new ApiErrorResponse(ModelState)); + return Ok(ApiOkResponse.Response(CustomFieldType.ValidCustomFieldTypes, true)); + } /// @@ -244,7 +246,7 @@ namespace AyaNova.Api.Controllers // if (!ModelState.IsValid) // return BadRequest(new ApiErrorResponse(ModelState)); - + // //Create and validate // FormCustom o = await biz.CreateAsync(inObj); // if (o == null) diff --git a/server/AyaNova/Startup.cs b/server/AyaNova/Startup.cs index 579039e4..62a51dc3 100644 --- a/server/AyaNova/Startup.cs +++ b/server/AyaNova/Startup.cs @@ -447,6 +447,7 @@ namespace AyaNova if (TESTING_REFRESH_DB) { AyaNova.Core.License.Fetch(apiServerState, dbContext, _newLog); + //NOTE: For unit testing make sure the time zone in util is set to the same figure as here to ensure list filter by date tests will work because server is on same page as user in terms of time Util.Seeder.SeedDatabase(Util.Seeder.SeedLevel.SmallOneManShopTrialDataSet, -7);//############################################################################################# } //TESTING diff --git a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs index 79ee44e8..2ed61379 100644 --- a/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs +++ b/server/AyaNova/biz/FilterSqlCriteriaBuilder.cs @@ -442,6 +442,9 @@ namespace AyaNova.Biz break; case FilterSpecialToken.NextMonth: + //BUGBUG? + //SERVER thinks midnight UTC is 7am our time on January 1st 2020 + //TEST thinks midnight UTC is 8am our time on January 1st 2020 //start with the first day of this month dtAfter = new DateTime(RelativeToday.Year, RelativeToday.Month, 1, RelativeToday.Hour, RelativeToday.Minute, 00); //Add a Month