This commit is contained in:
@@ -51,14 +51,14 @@ namespace AyaNova.Api.Controllers
|
||||
/// <returns>Collection with paging data</returns>
|
||||
// [HttpPost("List", Name = nameof(List))]
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> List([FromBody] ListOptions listOptions)
|
||||
public async Task<IActionResult> List([FromBody] DataListOptions listOptions)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (listOptions.Limit == null || listOptions.Limit < 1)
|
||||
{
|
||||
listOptions.Limit = ListOptions.DefaultLimit;
|
||||
listOptions.Limit = DataListOptions.DefaultLimit;
|
||||
}
|
||||
if (listOptions.Offset == null)
|
||||
{
|
||||
|
||||
@@ -53,7 +53,7 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="pickListParams">Parameters for pick list see api docs for details </param>
|
||||
/// <returns>Filtered list</returns>
|
||||
[HttpPost("list")]
|
||||
public async Task<IActionResult> PostList([FromBody] PickListParams pickListParams)
|
||||
public async Task<IActionResult> PostList([FromBody] PickListOptions pickListParams)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace AyaNova.DataList
|
||||
// Get the data list data requested
|
||||
//
|
||||
//
|
||||
internal static async Task<ApiDataListResponse> GetResponseAsync(string DataListKey, AyContext ct, ListOptions listOptions, AuthorizationRoles UserRoles, ILogger log, long userId)
|
||||
internal static async Task<ApiDataListResponse> GetResponseAsync(string DataListKey, AyContext ct, DataListOptions listOptions, AuthorizationRoles UserRoles, ILogger log, long userId)
|
||||
{
|
||||
|
||||
var DataList = DataListFactory.GetAyaDataList(DataListKey);
|
||||
@@ -84,8 +84,8 @@ namespace AyaNova.DataList
|
||||
qOrderBy = DataListSqlFilterOrderByBuilder.DataFilterToSQLOrderBy(DataList.FieldDefinitions, InternalListViewArray);
|
||||
|
||||
//LIMIT AND OFFSET CLAUSE - PAGING
|
||||
listOptions.Offset = listOptions.Offset ?? ListOptions.DefaultOffset;
|
||||
listOptions.Limit = listOptions.Limit ?? ListOptions.DefaultLimit;
|
||||
listOptions.Offset = listOptions.Offset ?? DataListOptions.DefaultOffset;
|
||||
listOptions.Limit = listOptions.Limit ?? DataListOptions.DefaultLimit;
|
||||
var qLimitOffset = $"LIMIT {listOptions.Limit} OFFSET {listOptions.Offset}";
|
||||
|
||||
//PUT IT ALL TOGETHER
|
||||
|
||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Mvc;
|
||||
namespace AyaNova.DataList
|
||||
{
|
||||
|
||||
public sealed class ListOptions
|
||||
public sealed class DataListOptions
|
||||
{
|
||||
public const int MaxPageSize = 1000;
|
||||
public const int DefaultOffset = 0;
|
||||
@@ -19,6 +19,13 @@ namespace AyaNova.DataList
|
||||
[FromBody, Required]
|
||||
public string DataListKey { get; set; }
|
||||
|
||||
/*
|
||||
columns:["PartInventoryTransactionEntryDate","PartPartNumber","PartWarehouseName","PartInventoryTransactionQuantity","PartInventoryTransactionDescription","PartInventoryTransactionSource","PartInventoryBalance"]
|
||||
sortBy:["PartInventoryTransactionEntryDate"],//same as grid natively does all columns here
|
||||
sortDesc:[true],//same as grid natively does, all columns here true or false each
|
||||
filter:[{column:"PartPartNumber",items:[{op: "=",value: "400735"}]}],
|
||||
variant:"string"
|
||||
*/
|
||||
[FromBody]
|
||||
public string ListView { get; set; }//optional, if null or empty will use default list view built into DataList
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace AyaNova.PickList
|
||||
/// <param name="preIds">Return only specific items (for pre-selected items on forms) </param>
|
||||
/// <param name="variant">Some lists optionally take a variant string, e.g. User type "inside","outside" etc </param>
|
||||
*/
|
||||
public sealed class PickListParams
|
||||
public sealed class PickListOptions
|
||||
{
|
||||
|
||||
[FromBody]
|
||||
@@ -32,7 +32,7 @@ namespace AyaNova.PickList
|
||||
[FromBody]
|
||||
public string ListVariant { get; set; }
|
||||
|
||||
public PickListParams()
|
||||
public PickListOptions()
|
||||
{
|
||||
AyaType = AyaType.NoType;
|
||||
Query = string.Empty;
|
||||
|
||||
Reference in New Issue
Block a user