This commit is contained in:
2018-11-30 00:48:51 +00:00
parent b01c48fa49
commit 9897924879
4 changed files with 13 additions and 14 deletions

View File

@@ -33,11 +33,14 @@ Upon user selecting a filter to use the list query string has the regular paging
- If list not found then it will return a 404 instead of the list
- server loads the filter, generates the sql based on the stored filter, adds the sort by and offset / page, runs the query and then returns the data as json collection to the client
NOTE: determined it would be too much trouble for too little gain to validate that the fields specified in the filter actually exist for that object
LIST FILTERING TODO
- DONE test for fetching widget filter options (localized, so have two users test each for expected response)
Need way to check if fields are valid for the object list in question both from the list Datafilter route and future SQL builder
Add test for excercising all of DataFilterController route including rights to non personal alternative owner etc
Add test for correctly validated Widget datafilter when saved or updated via datafiltercontroller (sanity check of the filter settings and options IFilterableObject implemented)

View File

@@ -261,19 +261,24 @@ namespace AyaNova.Biz
var filterItem = v[i];
if (filterItem["fld"] == null)
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"fld\" property ");
else{
//todo: find the filteroptions object adn confirm this is a valid value for fld
}
else
{
var fld = filterItem["fld"].Value<string>();
if (string.IsNullOrWhiteSpace(fld))
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, \"fld\" property is empty and required");
}
if (filterItem["op"] == null)
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"op\" property ");
else
{
var opType = filterItem["op"].Value<string>();
if (!FilterComparisonOperator.Operators.Contains(opType))
AddError(ValidationErrorType.InvalidValue, "Filter", $"Filter array item {i}, \"op\" value of \"{opType}\" is not a valid FilterComparisonOperator type");
AddError(ValidationErrorType.InvalidValue, "Filter", $"Filter array item {i}, \"op\" property value of \"{opType}\" is not a valid FilterComparisonOperator type");
}
if (filterItem["value"] == null)
AddError(ValidationErrorType.RequiredPropertyEmpty, "Filter", $"Filter array item {i}, object is missing required \"value\" property ");
//NOTE: value of nothing, null or empty is a valid value so no checking for it here
}
}
catch (Newtonsoft.Json.JsonReaderException ex)

View File

@@ -16,11 +16,6 @@ namespace AyaNova.Biz
//FILTEROPTIONS COLLECTION
FilterOptions FilterOptions { get; }
List<FilterField> FilterFields {get;}
//VALIDATE FILTER?
}

View File

@@ -33,11 +33,7 @@ namespace AyaNova.Biz
}
}
public static List<FilterField> FilterFields(){
List<FilterField> fields=new List<FilterField>();
fields.Add(new FilterField())
}
internal WidgetBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles UserRoles)
{
ct = dbcontext;