This commit is contained in:
@@ -76,27 +76,7 @@ namespace AyaNova.Api.Controllers
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
//Here need to handle scenario of badly formed query so user knows they did it wrong and doesn't just assume it's not there
|
||||
/*
|
||||
string TagSpecificQuery=string.Empty;
|
||||
|
||||
//determine if this is a tag query
|
||||
if(HasAutoCompleteQuery){
|
||||
if(autoCompleteQuery.Contains(" ")){
|
||||
//split the query on space
|
||||
var querySegments=autoCompleteQuery.Split(' ');
|
||||
//users may type several spaces in a regular query, so ignore that and only use the first two segments
|
||||
if(querySegments[0].Contains("..")){
|
||||
TagSpecificQuery=querySegments[0].Replace("..","");
|
||||
//the second string is considered the
|
||||
autoCompleteQuery=querySegments[1];
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
var UserRoles = UserRolesFromContext.Roles(HttpContext.Items);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace AyaNova.PickList
|
||||
{
|
||||
|
||||
|
||||
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(AyaType ayaType, string autoCompleteQuery, bool includeInactive, AyContext ct, AuthorizationRoles userRoles)
|
||||
internal static async Task<List<NameIdActiveItem>> GetResponseAsync(AyaType ayaType, string autoCompleteQuery, string tagSpecificQuery, bool includeInactive, AyContext ct, AuthorizationRoles userRoles)
|
||||
{
|
||||
|
||||
var PickList = PickListFactory.GetAyaPickList(ayaType);
|
||||
@@ -55,7 +55,7 @@ namespace AyaNova.PickList
|
||||
|
||||
//BUILD THE QUERY
|
||||
|
||||
var q = PickListSqlBuilder.Build(PickList, TemplateColumnNames, autoCompleteQuery, includeInactive);
|
||||
var q = PickListSqlBuilder.Build(PickList, TemplateColumnNames, autoCompleteQuery, tagSpecificQuery, includeInactive);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -58,8 +58,43 @@ namespace AyaNova.Biz
|
||||
//get picklist
|
||||
internal async Task<List<NameIdActiveItem>> GetPickListAsync(AyaType ayaType, string query, bool inactive, AuthorizationRoles userRoles)
|
||||
{
|
||||
//Crack and validate the query part set a broken rule if not valid and return null
|
||||
//else do the query
|
||||
string TagSpecificQuery = null;
|
||||
string AutoCompleteQuery = null;
|
||||
|
||||
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(ayaType, query, inactive, ct, userRoles);
|
||||
//Here need to handle scenario of badly formed query so user knows they did it wrong and doesn't just assume it's not there
|
||||
|
||||
//determine if this is a tag query
|
||||
bool HasAutoCompleteQuery = !string.IsNullOrWhiteSpace(query);
|
||||
if (HasAutoCompleteQuery)
|
||||
{
|
||||
if (AutoCompleteQuery.Contains(" "))
|
||||
{
|
||||
// split the query on space
|
||||
var querySegments = AutoCompleteQuery.Split(' ');
|
||||
// users may type several spaces in a regular query, so ignore that and only use the first two segments
|
||||
if (querySegments[0].Contains(".."))
|
||||
{
|
||||
TagSpecificQuery = querySegments[0].Replace("..", "");
|
||||
// the second string is considered the
|
||||
AutoCompleteQuery = querySegments[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//just a regular query
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
List<NameIdActiveItem> items = await PickListFetcher.GetResponseAsync(ayaType, AutoCompleteQuery, TagSpecificQuery, inactive, ct, userRoles);
|
||||
return items;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user