This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
## Pick list overview
|
||||
|
||||
some are search only, some pick and search etc
|
||||
initial form load preselected will not fill list if it doesn't have to to save bandwidth
|
||||
|
||||
## Selecting
|
||||
|
||||
|
||||
@@ -55,9 +55,10 @@ namespace AyaNova.Api.Controllers
|
||||
/// 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'</param>
|
||||
/// <param name="inactive">Include inactive objects in the returned list </param>
|
||||
/// <param name="preId">Return only one item (for pre-selected items on forms) </param>
|
||||
/// <returns>Filtered list</returns>
|
||||
[HttpGet("List")]
|
||||
public async Task<IActionResult> GetList([FromQuery]AyaType ayaType, [FromQuery]string query, [FromQuery] bool inactive)
|
||||
public async Task<IActionResult> GetList([FromQuery]AyaType ayaType, [FromQuery]string query, [FromQuery] bool inactive, [FromQuery]long preId)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
@@ -80,7 +81,7 @@ namespace AyaNova.Api.Controllers
|
||||
//Instantiate the business object handler
|
||||
PickListBiz biz = PickListBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
var o = await biz.GetPickListAsync(PickList, query, inactive, log);
|
||||
var o = await biz.GetPickListAsync(PickList, query, inactive, preId, log);
|
||||
if (o == null)
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
else
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace AyaNova.PickList
|
||||
internal static class PickListFetcher
|
||||
{
|
||||
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(IAyaPickList PickList, string autoCompleteQuery,
|
||||
string tagSpecificQuery, bool includeInactive, AyContext ct, ILogger log)
|
||||
string tagSpecificQuery, bool includeInactive, long preId, AyContext ct, ILogger log)
|
||||
{
|
||||
|
||||
//Sort out effective Template
|
||||
@@ -68,7 +68,7 @@ namespace AyaNova.PickList
|
||||
//log out the exception and the query
|
||||
log.LogInformation("PickList query failed unexpectedly. Query was:");
|
||||
log.LogInformation(q);
|
||||
log.LogInformation(e,"DB Exception");
|
||||
log.LogInformation(e, "DB Exception");
|
||||
throw new System.Exception("PickListFetcher - Query failed see log");
|
||||
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
//get picklist
|
||||
internal async Task<List<NameIdActiveItem>> GetPickListAsync(IAyaPickList PickList, string query, bool inactive, ILogger log)
|
||||
internal async Task<List<NameIdActiveItem>> GetPickListAsync(IAyaPickList PickList, string query, bool inactive, long preId, ILogger log)
|
||||
{
|
||||
|
||||
//Crack and validate the query part set a broken rule if not valid and return null
|
||||
@@ -134,7 +134,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//Autocomplete and tagonly query terms now set for consumption by PickListFetcher, ready to fetch...
|
||||
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(PickList, AutoCompleteQuery, TagSpecificQuery, inactive, ct, log);
|
||||
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(PickList, AutoCompleteQuery, TagSpecificQuery, inactive, preId, ct, log);
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user