This commit is contained in:
@@ -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
|
- 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
|
- 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
|
||||||
|
--------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
return Ok(new
|
return Ok(new
|
||||||
{
|
{
|
||||||
data = biz.FilterOptions
|
data = WidgetBiz.FilterOptions(biz.UserLocaleId)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,24 +13,22 @@ using System.Collections.Generic;
|
|||||||
namespace AyaNova.Biz
|
namespace AyaNova.Biz
|
||||||
{
|
{
|
||||||
|
|
||||||
|
internal class WidgetBiz : BizObject, IJobObject
|
||||||
internal class WidgetBiz : BizObject, IJobObject, IFilterableObject
|
|
||||||
{
|
{
|
||||||
public FilterOptions FilterOptions
|
public static FilterOptions FilterOptions(long localizeToLocaleId = 0)
|
||||||
{
|
{
|
||||||
get
|
FilterOptions f = new FilterOptions("Widget");
|
||||||
{
|
f.
|
||||||
FilterOptions f = new FilterOptions("Widget");
|
AddField("Name", "WidgetName", AyDataType.Text).
|
||||||
f.
|
AddField("Serial", "WidgetSerial", AyDataType.Text).
|
||||||
AddField("Name", "WidgetName", AyDataType.Text).
|
AddField("DollarAmount", "WidgetDollarAmount", AyDataType.Decimal).
|
||||||
AddField("Serial", "WidgetSerial", AyDataType.Text).
|
AddField("Active", "WidgetActive", AyDataType.Bool).
|
||||||
AddField("DollarAmount", "WidgetDollarAmount", AyDataType.Decimal).
|
AddField("StartDate", "WidgetStartDate", AyDataType.Date).
|
||||||
AddField("Active", "WidgetActive", AyDataType.Bool).
|
AddField("EndDate", "WidgetEndDate", AyDataType.Date);
|
||||||
AddField("StartDate", "WidgetStartDate", AyDataType.Date).
|
|
||||||
AddField("EndDate", "WidgetEndDate", AyDataType.Date);
|
if (localizeToLocaleId != 0)
|
||||||
f.Localize(UserLocaleId);
|
f.Localize(localizeToLocaleId);
|
||||||
return f;
|
return f;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user