From 9a6889d8596b124cb0da80d2ad93c74349f26785 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 13 Jan 2021 17:49:17 +0000 Subject: [PATCH] --- .../AyaNova/Controllers/PickListController.cs | 18 ++++------ server/AyaNova/PickList/PickListParams.cs | 36 +++++++++++++++++++ 2 files changed, 42 insertions(+), 12 deletions(-) create mode 100644 server/AyaNova/PickList/PickListParams.cs diff --git a/server/AyaNova/Controllers/PickListController.cs b/server/AyaNova/Controllers/PickListController.cs index 7ca73a17..c53bc1b3 100644 --- a/server/AyaNova/Controllers/PickListController.cs +++ b/server/AyaNova/Controllers/PickListController.cs @@ -50,16 +50,10 @@ namespace AyaNova.Api.Controllers /// "zon some" is NOT valid (missing TAGS indicator), "..zone some re" is NOT valid (too many strings) /// Note that this list is capped automatically to return no more than 100 results /// - /// The AyaType object type to select from - /// The query to filter the returned list by. Query text as provided will be case sensitively matched to all templated fields. - /// Independantely of this, if an addition space separated string that begins with two consecutive periods is encountered that will be considered a separate match to the TAGS collection of each object - /// So a tag query might be entered as "..zon some" which would match all tags LIKE 'zon' and template fields LIKE 'some' - /// Include inactive objects in the returned list - /// Return only specific items (for pre-selected items on forms) - /// Some lists optionally take a variant string, e.g. User type "inside","outside" etc + /// Parameters for pick list see api docs for details /// Filtered list - [HttpGet("list")] - public async Task GetList([FromQuery] AyaType ayaType, [FromQuery] string query, [FromQuery] bool inactive, [FromQuery] long[] preIds, [FromQuery] string variant) + [HttpPost("list")] + public async Task PostList([FromBody] PickListParams pickListParams) { if (serverState.IsClosed) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); @@ -69,7 +63,7 @@ namespace AyaNova.Api.Controllers //NOTE: these sequence of calls are a little different than other objects due to the nature of rights and stuff with picklists being different - var PickList = PickListFactory.GetAyaPickList(ayaType); + var PickList = PickListFactory.GetAyaPickList(pickListParams.AyaType); //was the name not found as a pick list? if (PickList == null) @@ -82,8 +76,8 @@ namespace AyaNova.Api.Controllers //Instantiate the business object handler PickListBiz biz = PickListBiz.GetBiz(ct, HttpContext); - - var o = await biz.GetPickListAsync(PickList, query, inactive, preIds, variant, log); + + var o = await biz.GetPickListAsync(PickList, pickListParams.Query, pickListParams.Inactive, pickListParams.PreselectedIds.ToArray(), pickListParams.ListVariant, log); if (o == null) return BadRequest(new ApiErrorResponse(biz.Errors)); else diff --git a/server/AyaNova/PickList/PickListParams.cs b/server/AyaNova/PickList/PickListParams.cs new file mode 100644 index 00000000..7a93f950 --- /dev/null +++ b/server/AyaNova/PickList/PickListParams.cs @@ -0,0 +1,36 @@ +using Microsoft.AspNetCore.Mvc; +using System.Collections.Generic; +using AyaNova.Biz; + +namespace AyaNova.PickList +{ + +/* + /// The AyaType object type to select from + /// The query to filter the returned list by. Query text as provided will be case sensitively matched to all templated fields. + /// Independantely of this, if an addition space separated string that begins with two consecutive periods is encountered that will be considered a separate match to the TAGS collection of each object + /// So a tag query might be entered as "..zon some" which would match all tags LIKE 'zon' and template fields LIKE 'some' + /// Include inactive objects in the returned list + /// Return only specific items (for pre-selected items on forms) + /// Some lists optionally take a variant string, e.g. User type "inside","outside" etc +*/ + public sealed class PickListParams + { + + [FromBody] + public AyaType AyaType { get; set; } + + [FromBody] + public string Query { get; set; } + + [FromBody] + public bool Inactive { get; set; } + + [FromBody] + public List PreselectedIds { get; set; } + + [FromBody] + public string ListVariant { get; set; } + } + +} \ No newline at end of file