This commit is contained in:
@@ -76,8 +76,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
DataListSavedColumnViewBiz biz = DataListSavedColumnViewBiz.GetBiz(ct, HttpContext);
|
DataListSavedColumnViewBiz viewbiz = DataListSavedColumnViewBiz.GetBiz(ct, HttpContext);
|
||||||
var SavedView = await biz.GetAsync(biz.UserId, tableRequest.DataListKey, true);
|
var SavedView = await viewbiz.GetAsync(UserId, tableRequest.DataListKey, true);
|
||||||
|
|
||||||
|
DataListSavedFilterBiz filterbiz = DataListSavedFilterBiz.GetBiz(ct, HttpContext);
|
||||||
|
var SavedFilter = await filterbiz.GetAsync(UserId, tableRequest.DataListKey, true);
|
||||||
|
|
||||||
var DataList = DataListFactory.GetAyaDataList(tableRequest.DataListKey);
|
var DataList = DataListFactory.GetAyaDataList(tableRequest.DataListKey);
|
||||||
if (DataList == null)
|
if (DataList == null)
|
||||||
return BadRequest(new ApiErrorResponse(ApiErrorCode.NOT_FOUND, "DataListKey", $"DataList \"{tableRequest.DataListKey}\" specified does not exist"));
|
return BadRequest(new ApiErrorResponse(ApiErrorCode.NOT_FOUND, "DataListKey", $"DataList \"{tableRequest.DataListKey}\" specified does not exist"));
|
||||||
@@ -87,7 +91,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||||
|
|
||||||
//hydrate the saved view and filter
|
//hydrate the saved view and filter
|
||||||
DataListTableProcessingOptions dataListTableOptions = new DataListTableProcessingOptions(tableRequest, DataList, SavedView);
|
DataListTableProcessingOptions dataListTableOptions = new DataListTableProcessingOptions(tableRequest, DataList, SavedView, SavedFilter,UserId, UserRoles);
|
||||||
DataListReturnData r = await DataListFetcher.GetResponseAsync(ct, dataListTableOptions, DataList, UserRoles, log, UserId);
|
DataListReturnData r = await DataListFetcher.GetResponseAsync(ct, dataListTableOptions, DataList, UserRoles, log, UserId);
|
||||||
return Ok(r);
|
return Ok(r);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using AyaNova.DataList;
|
using AyaNova.DataList;
|
||||||
|
using AyaNova.Biz;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
|
|
||||||
@@ -18,7 +19,9 @@ namespace AyaNova.Models
|
|||||||
DataListTableRequest request,
|
DataListTableRequest request,
|
||||||
IDataListProcessing dataList,
|
IDataListProcessing dataList,
|
||||||
DataListSavedColumnView savedView,
|
DataListSavedColumnView savedView,
|
||||||
DataListSavedFilter savedFilter)
|
DataListSavedFilter savedFilter,
|
||||||
|
long userId,
|
||||||
|
AuthorizationRoles userRoles)
|
||||||
{
|
{
|
||||||
//set some values from request
|
//set some values from request
|
||||||
Limit = request.Limit;
|
Limit = request.Limit;
|
||||||
@@ -26,8 +29,6 @@ namespace AyaNova.Models
|
|||||||
base.ClientCriteria = request.ClientCriteria;
|
base.ClientCriteria = request.ClientCriteria;
|
||||||
base.DataListKey = request.DataListKey;
|
base.DataListKey = request.DataListKey;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//SET COLUMNS
|
//SET COLUMNS
|
||||||
Columns = JsonConvert.DeserializeObject<List<string>>(savedView.Columns);
|
Columns = JsonConvert.DeserializeObject<List<string>>(savedView.Columns);
|
||||||
|
|
||||||
@@ -36,14 +37,30 @@ namespace AyaNova.Models
|
|||||||
|
|
||||||
//SET FILTER
|
//SET FILTER
|
||||||
if (request.FilterId != 0)
|
if (request.FilterId != 0)
|
||||||
{
|
|
||||||
base.Filter = JsonConvert.DeserializeObject<List<DataListFilterOption>>(savedFilter.Filter);
|
base.Filter = JsonConvert.DeserializeObject<List<DataListFilterOption>>(savedFilter.Filter);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//SERVER FILTER PROCESSING HERE CODE SEE DATALISTFETCHER
|
//SERVER FILTER PROCESSING HERE CODE SEE DATALISTFETCHER
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
List<DataListFilterOption> StaticServerFilterOptions = new List<DataListFilterOption>();
|
||||||
|
if (DataList is IDataListInternalCriteria)
|
||||||
|
StaticServerFilterOptions = ((IDataListInternalCriteria)DataList).DataListInternalCriteria(userId, userRoles, dataListTableOptions);
|
||||||
|
|
||||||
|
|
||||||
|
// //Get the public field key names in a list from the listview
|
||||||
|
// List<string> PublicListViewFieldList = listOptions.Columns;
|
||||||
|
|
||||||
|
//Get the combination of all unique fields from both StaticServerFilterOptions and listOptions
|
||||||
|
//NOTE: this assumes no list options filter colums that don't exist in listoptions.columns
|
||||||
|
var AllUniqueFieldKeysRequiredForQuery = dataListTableOptions.Columns.Union(StaticServerFilterOptions.Select(z => z.Column).ToList()).ToList();
|
||||||
|
|
||||||
|
//Add the internal filters into the listoptions existing filters
|
||||||
|
//NOTE: There is currently no overlap between internal filtered columns and filters coming from the client
|
||||||
|
foreach (DataListFilterOption dfo in StaticServerFilterOptions)
|
||||||
|
dataListTableOptions.Filter.Add(dfo);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user