diff --git a/devdocs/specs/core-list-graph-datatable-filtering-paging.txt b/devdocs/specs/core-list-graph-datatable-filtering-paging.txt index d3870c81..cadb4a90 100644 --- a/devdocs/specs/core-list-graph-datatable-filtering-paging.txt +++ b/devdocs/specs/core-list-graph-datatable-filtering-paging.txt @@ -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 +-------------------------------------------------- diff --git a/server/AyaNova/Controllers/WidgetController.cs b/server/AyaNova/Controllers/WidgetController.cs index 78aa1f84..e6a94aca 100644 --- a/server/AyaNova/Controllers/WidgetController.cs +++ b/server/AyaNova/Controllers/WidgetController.cs @@ -100,7 +100,7 @@ namespace AyaNova.Api.Controllers return Ok(new { - data = biz.FilterOptions + data = WidgetBiz.FilterOptions(biz.UserLocaleId) }); } diff --git a/server/AyaNova/biz/WidgetBiz.cs b/server/AyaNova/biz/WidgetBiz.cs index 097f6fdf..e8bed684 100644 --- a/server/AyaNova/biz/WidgetBiz.cs +++ b/server/AyaNova/biz/WidgetBiz.cs @@ -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; }