This commit is contained in:
2021-01-29 21:51:34 +00:00
parent 740323c67d
commit 3bc7aba2c2
14 changed files with 32 additions and 35 deletions

View File

@@ -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)
{

View File

@@ -50,7 +50,7 @@ namespace AyaNova.Api.Controllers
/// <param name="dataListSelection"></param>
/// <returns>downloadable export file name</returns>
[HttpPost("render/{format}")]
public async Task<IActionResult> RenderExport([FromRoute] string format, [FromBody] DataListSelectionOptions dataListSelection)
public async Task<IActionResult> RenderExport([FromRoute] string format, [FromBody] DataListSelectedProcessingOptions dataListSelection)
{
if (!serverState.IsOpen)

View File

@@ -196,7 +196,7 @@ namespace AyaNova.Api.Controllers
/// <param name="dataListSelection"></param>
/// <returns>Job Id</returns>
[HttpPost("batch-delete")]
public async Task<IActionResult> BatchDeleteObjects([FromBody] DataListSelectionOptions dataListSelection)
public async Task<IActionResult> BatchDeleteObjects([FromBody] DataListSelectedProcessingOptions dataListSelection)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));

View File

@@ -188,7 +188,7 @@ namespace AyaNova.Api.Controllers
/// <param name="apiVersion">From route path</param>
/// <returns></returns>
[HttpPost("data")]
public async Task<IActionResult> GetReportData([FromBody] DataListSelectionOptions reportDataParam, ApiVersion apiVersion)
public async Task<IActionResult> 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
/// <param name="apiVersion">From route path</param>
/// <returns>downloadable pdf name</returns>
[HttpPost("render")]
public async Task<IActionResult> RenderReport([FromBody] DataListReportSelectionOptions reportParam, ApiVersion apiVersion)
public async Task<IActionResult> RenderReport([FromBody] DataListReportProcessingOptions reportParam, ApiVersion apiVersion)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));

View File

@@ -83,7 +83,7 @@ namespace AyaNova.Api.Controllers
/// <param name="dataListSelection"></param>
/// <returns>Job Id</returns>
[HttpPost("batch-add/{tag}")]
public async Task<IActionResult> BatchAdd([FromRoute] string tag, [FromBody] DataListSelectionOptions dataListSelection)
public async Task<IActionResult> 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
/// <param name="dataListSelection"></param>
/// <returns>Job Id</returns>
[HttpPost("batch-remove/{tag}")]
public async Task<IActionResult> BatchRemove([FromRoute] string tag, [FromBody] DataListSelectionOptions dataListSelection)
public async Task<IActionResult> 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
/// <param name="dataListSelection"></param>
/// <returns>Job Id</returns>
[HttpPost("batch-replace/{fromTag}")]
public async Task<IActionResult> BatchReplace([FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] DataListSelectionOptions dataListSelection)
public async Task<IActionResult> BatchReplace([FromRoute] string fromTag, [FromQuery] string toTag, [FromBody] DataListSelectedProcessingOptions dataListSelection)
{
if (!serverState.IsOpen)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));

View File

@@ -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<long[]> GetIdListResponseAsync(string dataListKey, string listView, string metaListView, AyContext ct, AuthorizationRoles userRoles, ILogger log, long userId)
internal static async Task<long[]> GetIdListResponseAsync(AyContext ct, DataListSelectionOptions dataListSelectionOptions, AuthorizationRoles userRoles, ILogger log, long userId)
internal static async Task<long[]> 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?

View File

@@ -50,9 +50,9 @@ namespace AyaNova.DataList
listOptions.SortBy = new Dictionary<string, string>();
//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<string>();
//if this doesn't work then just ditch this method in favor of local code, it's not really saving much

View File

@@ -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<DataListFieldDefinition> fieldDefinitions, DataListSelectionOptions dataListSelectionOptions)
internal static string BuildForIdListResponse(List<DataListFieldDefinition> 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

View File

@@ -331,7 +331,7 @@ namespace AyaNova.Biz
//REPORT DATA
//Data fetched to return to report designer for Client report design usage
public async Task<Newtonsoft.Json.Linq.JArray> GetReportData(DataListSelectionOptions dataListSelection)
public async Task<Newtonsoft.Json.Linq.JArray> 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<string> RenderReport(DataListReportSelectionOptions reportParam, string apiUrl)
public async Task<string> RenderReport(DataListReportProcessingOptions reportParam, string apiUrl)
{
var log = AyaNova.Util.ApplicationLogging.CreateLogger("ReportBiz::RenderReport");

View File

@@ -1,4 +1,3 @@
using System.Collections.Generic;
namespace AyaNova.Models
{
public class DataListColumnFilter

View File

@@ -1,10 +1,19 @@
using System.Collections.Generic;
namespace AyaNova.Models
{
{
public class DataListFilterOption
{
public string Column { get; set; }
public List<DataListColumnFilter> Items { get; set; }
public bool Any { get; set; }//means "or" the filter conditions
public DataListFilterOption()
{
Items = new List<DataListColumnFilter>();
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<DataListColumnFilter> Items { get; set; }
public bool Any { get; set; }//means "or" the filter conditions
public DataListFilterOption()
{
Items = new List<DataListColumnFilter>();
Any = false;
}
}
}

View File

@@ -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

View File

@@ -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; }

View File

@@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace AyaNova.Models
{
public sealed class DataListTableOptions : DataListProcessingBase
public sealed class DataListTableProcessingOptions : DataListProcessingBase
{
public List<string> Columns { get; set; }
public const int MaxPageSize = 1000;