This commit is contained in:
2018-11-30 18:56:30 +00:00
parent c886fa8815
commit 793695942e
3 changed files with 32 additions and 19 deletions

View File

@@ -33,7 +33,22 @@ 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
--------------------------------------------------------
NOTES ABOUT WHY I DID THE FILTEROPTIONS LIKE I DID:
//Need a collection of fields and types and locale keys for
// - Client fetching filteroptions via list class
// - Just a static list of items localized and sent to the client
// - DataFilter validation via list class
// - static list of items to compare against
// - ToSql from DataFilter validation and query building via list class
// - Static list of filter options so that it can build sql fragment (needs to know type, possibly the field name [or that is inferred probably])
// - Ideally each list object will have it's own chunk of code to handle it's shit with tosql just making the fragments of sql like in v7
// - Again, a static list of items to check against
//Where to store that?
//all cases are via list class so really the whole thing is self contained and no need for an interface at all
--------------------------------------------------

View File

@@ -100,7 +100,7 @@ namespace AyaNova.Api.Controllers
return Ok(new
{
data = biz.FilterOptions
data = WidgetBiz.FilterOptions(biz.UserLocaleId)
});
}

View File

@@ -12,25 +12,23 @@ using System.Collections.Generic;
namespace AyaNova.Biz
{
internal class WidgetBiz : BizObject, IJobObject, IFilterableObject
internal class WidgetBiz : BizObject, IJobObject
{
public FilterOptions FilterOptions
public static FilterOptions FilterOptions(long localizeToLocaleId = 0)
{
get
{
FilterOptions f = new FilterOptions("Widget");
f.
AddField("Name", "WidgetName", AyDataType.Text).
AddField("Serial", "WidgetSerial", AyDataType.Text).
AddField("DollarAmount", "WidgetDollarAmount", AyDataType.Decimal).
AddField("Active", "WidgetActive", AyDataType.Bool).
AddField("StartDate", "WidgetStartDate", AyDataType.Date).
AddField("EndDate", "WidgetEndDate", AyDataType.Date);
f.Localize(UserLocaleId);
return f;
}
FilterOptions f = new FilterOptions("Widget");
f.
AddField("Name", "WidgetName", AyDataType.Text).
AddField("Serial", "WidgetSerial", AyDataType.Text).
AddField("DollarAmount", "WidgetDollarAmount", AyDataType.Decimal).
AddField("Active", "WidgetActive", AyDataType.Bool).
AddField("StartDate", "WidgetStartDate", AyDataType.Date).
AddField("EndDate", "WidgetEndDate", AyDataType.Date);
if (localizeToLocaleId != 0)
f.Localize(localizeToLocaleId);
return f;
}