From 3bc7aba2c2961575613f02edb8c3bd608ce2b2d9 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 29 Jan 2021 21:51:34 +0000 Subject: [PATCH] --- .../AyaNova/Controllers/DataListController.cs | 2 +- .../AyaNova/Controllers/ExportController.cs | 2 +- .../Controllers/JobOperationsController.cs | 2 +- .../AyaNova/Controllers/ReportController.cs | 4 +-- server/AyaNova/Controllers/TagController.cs | 6 ++-- server/AyaNova/DataList/DataListFetcher.cs | 6 ++-- .../DataList/DataListProcessingBase.cs | 4 +-- .../DataList/DataListSqlSelectBuilder.cs | 2 +- server/AyaNova/biz/ReportBiz.cs | 4 +-- server/AyaNova/models/DataListColumnFilter.cs | 1 - server/AyaNova/models/DataListFilterOption.cs | 28 +++++++++---------- ....cs => DataListReportProcessingOptions.cs} | 2 +- ...s => DataListSelectedProcessingOptions.cs} | 2 +- ...s.cs => DataListTableProcessingOptions.cs} | 2 +- 14 files changed, 32 insertions(+), 35 deletions(-) rename server/AyaNova/models/{DataListReportSelectionOptions.cs => DataListReportProcessingOptions.cs} (87%) rename server/AyaNova/models/{DataListSelectionOptions.cs => DataListSelectedProcessingOptions.cs} (92%) rename server/AyaNova/models/{DataListTableOptions.cs => DataListTableProcessingOptions.cs} (78%) diff --git a/server/AyaNova/Controllers/DataListController.cs b/server/AyaNova/Controllers/DataListController.cs index 00fee435..d82fe982 100644 --- a/server/AyaNova/Controllers/DataListController.cs +++ b/server/AyaNova/Controllers/DataListController.cs @@ -58,7 +58,7 @@ namespace AyaNova.Api.Controllers if (tableRequest.Limit == null || tableRequest.Limit < 1) { - tableRequest.Limit = DataListTableOptions.DefaultLimit; + tableRequest.Limit = DataListTableProcessingOptions.DefaultLimit; } if (tableRequest.Offset == null) { diff --git a/server/AyaNova/Controllers/ExportController.cs b/server/AyaNova/Controllers/ExportController.cs index 702abafd..a8a8b3a0 100644 --- a/server/AyaNova/Controllers/ExportController.cs +++ b/server/AyaNova/Controllers/ExportController.cs @@ -50,7 +50,7 @@ namespace AyaNova.Api.Controllers /// /// downloadable export file name [HttpPost("render/{format}")] - public async Task RenderExport([FromRoute] string format, [FromBody] DataListSelectionOptions dataListSelection) + public async Task RenderExport([FromRoute] string format, [FromBody] DataListSelectedProcessingOptions dataListSelection) { if (!serverState.IsOpen) diff --git a/server/AyaNova/Controllers/JobOperationsController.cs b/server/AyaNova/Controllers/JobOperationsController.cs index 98319891..d508848a 100644 --- a/server/AyaNova/Controllers/JobOperationsController.cs +++ b/server/AyaNova/Controllers/JobOperationsController.cs @@ -196,7 +196,7 @@ namespace AyaNova.Api.Controllers /// /// Job Id [HttpPost("batch-delete")] - public async Task BatchDeleteObjects([FromBody] DataListSelectionOptions dataListSelection) + public async Task BatchDeleteObjects([FromBody] DataListSelectedProcessingOptions dataListSelection) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); diff --git a/server/AyaNova/Controllers/ReportController.cs b/server/AyaNova/Controllers/ReportController.cs index 803259f4..c475194c 100644 --- a/server/AyaNova/Controllers/ReportController.cs +++ b/server/AyaNova/Controllers/ReportController.cs @@ -188,7 +188,7 @@ namespace AyaNova.Api.Controllers /// From route path /// [HttpPost("data")] - public async Task GetReportData([FromBody] DataListSelectionOptions reportDataParam, ApiVersion apiVersion) + public async Task GetReportData([FromBody] DataListSelectedProcessingOptions reportDataParam, ApiVersion apiVersion) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); @@ -210,7 +210,7 @@ namespace AyaNova.Api.Controllers /// From route path /// downloadable pdf name [HttpPost("render")] - public async Task RenderReport([FromBody] DataListReportSelectionOptions reportParam, ApiVersion apiVersion) + public async Task RenderReport([FromBody] DataListReportProcessingOptions reportParam, ApiVersion apiVersion) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); diff --git a/server/AyaNova/Controllers/TagController.cs b/server/AyaNova/Controllers/TagController.cs index deb2278f..d357f4ac 100644 --- a/server/AyaNova/Controllers/TagController.cs +++ b/server/AyaNova/Controllers/TagController.cs @@ -83,7 +83,7 @@ namespace AyaNova.Api.Controllers /// /// Job Id [HttpPost("batch-add/{tag}")] - public async Task BatchAdd([FromRoute] string tag, [FromBody] DataListSelectionOptions dataListSelection) + public async Task BatchAdd([FromRoute] string tag, [FromBody] DataListSelectedProcessingOptions dataListSelection) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); @@ -173,7 +173,7 @@ namespace AyaNova.Api.Controllers /// /// Job Id [HttpPost("batch-remove/{tag}")] - public async Task BatchRemove([FromRoute] string tag, [FromBody] DataListSelectionOptions dataListSelection) + public async Task BatchRemove([FromRoute] string tag, [FromBody] DataListSelectedProcessingOptions dataListSelection) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); @@ -266,7 +266,7 @@ namespace AyaNova.Api.Controllers /// /// Job Id [HttpPost("batch-replace/{fromTag}")] - public async Task BatchReplace([FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] DataListSelectionOptions dataListSelection) + public async Task BatchReplace([FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] DataListSelectedProcessingOptions dataListSelection) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); diff --git a/server/AyaNova/DataList/DataListFetcher.cs b/server/AyaNova/DataList/DataListFetcher.cs index 1a8848a7..8196e3d2 100644 --- a/server/AyaNova/DataList/DataListFetcher.cs +++ b/server/AyaNova/DataList/DataListFetcher.cs @@ -74,8 +74,8 @@ namespace AyaNova.DataList qOrderBy = DataListSqlFilterOrderByBuilder.DataFilterToSQLOrderBy(DataList.FieldDefinitions, dataListTableOptions); //LIMIT AND OFFSET CLAUSE - PAGING - dataListTableOptions.Offset = dataListTableOptions.Offset ?? DataListTableOptions.DefaultOffset; - dataListTableOptions.Limit = dataListTableOptions.Limit ?? DataListTableOptions.DefaultLimit; + dataListTableOptions.Offset = dataListTableOptions.Offset ?? DataListTableProcessingOptions.DefaultOffset; + dataListTableOptions.Limit = dataListTableOptions.Limit ?? DataListTableProcessingOptions.DefaultLimit; var qLimitOffset = $"LIMIT {dataListTableOptions.Limit} OFFSET {dataListTableOptions.Offset}"; //PUT IT ALL TOGETHER @@ -244,7 +244,7 @@ namespace AyaNova.DataList // // //internal static async Task GetIdListResponseAsync(string dataListKey, string listView, string metaListView, AyContext ct, AuthorizationRoles userRoles, ILogger log, long userId) - internal static async Task GetIdListResponseAsync(AyContext ct, DataListSelectionOptions dataListSelectionOptions, AuthorizationRoles userRoles, ILogger log, long userId) + internal static async Task GetIdListResponseAsync(AyContext ct, DataListSelectedProcessingOptions dataListSelectionOptions, AuthorizationRoles userRoles, ILogger log, long userId) { var DataList = DataListFactory.GetAyaDataList(dataListSelectionOptions.DataListKey); //was the name not found as a list? diff --git a/server/AyaNova/DataList/DataListProcessingBase.cs b/server/AyaNova/DataList/DataListProcessingBase.cs index 549b30ba..ece7acdf 100644 --- a/server/AyaNova/DataList/DataListProcessingBase.cs +++ b/server/AyaNova/DataList/DataListProcessingBase.cs @@ -50,9 +50,9 @@ namespace AyaNova.DataList listOptions.SortBy = new Dictionary(); //Check Columns - if (listOptions is DataListTableOptions) + if (listOptions is DataListTableProcessingOptions) { - var dlto = ((DataListTableOptions)listOptions); + var dlto = ((DataListTableProcessingOptions)listOptions); if (dlto.Columns == null) dlto.Columns = new List(); //if this doesn't work then just ditch this method in favor of local code, it's not really saving much diff --git a/server/AyaNova/DataList/DataListSqlSelectBuilder.cs b/server/AyaNova/DataList/DataListSqlSelectBuilder.cs index 57539ec4..9b375a77 100644 --- a/server/AyaNova/DataList/DataListSqlSelectBuilder.cs +++ b/server/AyaNova/DataList/DataListSqlSelectBuilder.cs @@ -114,7 +114,7 @@ namespace AyaNova.DataList //Build the SELECT portion of a list query but only to return rowid's - internal static string BuildForIdListResponse(List fieldDefinitions, DataListSelectionOptions dataListSelectionOptions) + internal static string BuildForIdListResponse(List fieldDefinitions, DataListSelectedProcessingOptions dataListSelectionOptions) { //BugBug - is not including internalcriteria OR user filtered columns so they don't filter properly //needs to be there and also return correct 0th column for id filtering or make sure it's always the zeroth I guess diff --git a/server/AyaNova/biz/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs index f0ae2ed7..6c300912 100644 --- a/server/AyaNova/biz/ReportBiz.cs +++ b/server/AyaNova/biz/ReportBiz.cs @@ -331,7 +331,7 @@ namespace AyaNova.Biz //REPORT DATA //Data fetched to return to report designer for Client report design usage - public async Task GetReportData(DataListSelectionOptions dataListSelection) + public async Task GetReportData(DataListSelectedProcessingOptions dataListSelection) { var log = AyaNova.Util.ApplicationLogging.CreateLogger("ReportBiz::GetReportData"); AuthorizationRoles effectiveRoles = CurrentUserRoles; @@ -360,7 +360,7 @@ namespace AyaNova.Biz //RENDER // - public async Task RenderReport(DataListReportSelectionOptions reportParam, string apiUrl) + public async Task RenderReport(DataListReportProcessingOptions reportParam, string apiUrl) { var log = AyaNova.Util.ApplicationLogging.CreateLogger("ReportBiz::RenderReport"); diff --git a/server/AyaNova/models/DataListColumnFilter.cs b/server/AyaNova/models/DataListColumnFilter.cs index fcd1b71d..0766f5bf 100644 --- a/server/AyaNova/models/DataListColumnFilter.cs +++ b/server/AyaNova/models/DataListColumnFilter.cs @@ -1,4 +1,3 @@ -using System.Collections.Generic; namespace AyaNova.Models { public class DataListColumnFilter diff --git a/server/AyaNova/models/DataListFilterOption.cs b/server/AyaNova/models/DataListFilterOption.cs index 9ded9b3a..183489c1 100644 --- a/server/AyaNova/models/DataListFilterOption.cs +++ b/server/AyaNova/models/DataListFilterOption.cs @@ -1,10 +1,19 @@ using System.Collections.Generic; namespace AyaNova.Models -{ +{ + public class DataListFilterOption + { + public string Column { get; set; } + public List Items { get; set; } + public bool Any { get; set; }//means "or" the filter conditions + public DataListFilterOption() + { + Items = new List(); + Any = false; + } + } - - - /* + /* OLD EXAMPLE: {"offset":0,"limit":10,"dataListKey":"CustomerDataList", "listView":"[ @@ -27,16 +36,5 @@ namespace AyaNova.Models columns and sort are a singleton per datalistkey,userid persisted automatically (no alternative "views" just one of these). User can set them or reset them to default. filter is different: user can persist a filter by name for future selection, sharing with others (public). The default filter is no filter. */ - public class DataListFilterOption - { - public string Column { get; set; } - public List Items { get; set; } - public bool Any { get; set; }//means "or" the filter conditions - public DataListFilterOption() - { - Items = new List(); - Any = false; - } - } } diff --git a/server/AyaNova/models/DataListReportSelectionOptions.cs b/server/AyaNova/models/DataListReportProcessingOptions.cs similarity index 87% rename from server/AyaNova/models/DataListReportSelectionOptions.cs rename to server/AyaNova/models/DataListReportProcessingOptions.cs index 9850560e..d1f830e6 100644 --- a/server/AyaNova/models/DataListReportSelectionOptions.cs +++ b/server/AyaNova/models/DataListReportProcessingOptions.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json.Linq; namespace AyaNova.Models { - public class DataListReportSelectionOptions : DataListSelectionOptions + public class DataListReportProcessingOptions : DataListSelectedProcessingOptions { public long ReportId { get; set; } public JToken ClientMeta { get; set; }//meta JSON data passed from client, not part of biz object data diff --git a/server/AyaNova/models/DataListSelectionOptions.cs b/server/AyaNova/models/DataListSelectedProcessingOptions.cs similarity index 92% rename from server/AyaNova/models/DataListSelectionOptions.cs rename to server/AyaNova/models/DataListSelectedProcessingOptions.cs index 3ce2babd..8d80170e 100644 --- a/server/AyaNova/models/DataListSelectionOptions.cs +++ b/server/AyaNova/models/DataListSelectedProcessingOptions.cs @@ -5,7 +5,7 @@ namespace AyaNova.Models //Used to drive processes that rely on selections made at client from a datalist //either a preselected list of id's or a datalist key and listview filter object that can //be used to rehydrate a list of id's - public class DataListSelectionOptions : DataListProcessingBase + public class DataListSelectedProcessingOptions : DataListProcessingBase { public AyaType ObjectType { get; set; } public long[] SelectedRowIds { get; set; } diff --git a/server/AyaNova/models/DataListTableOptions.cs b/server/AyaNova/models/DataListTableProcessingOptions.cs similarity index 78% rename from server/AyaNova/models/DataListTableOptions.cs rename to server/AyaNova/models/DataListTableProcessingOptions.cs index 17865093..fff11730 100644 --- a/server/AyaNova/models/DataListTableOptions.cs +++ b/server/AyaNova/models/DataListTableProcessingOptions.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace AyaNova.Models { - public sealed class DataListTableOptions : DataListProcessingBase + public sealed class DataListTableProcessingOptions : DataListProcessingBase { public List Columns { get; set; } public const int MaxPageSize = 1000;