This commit is contained in:
@@ -5,12 +5,14 @@ Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOiIxNTQ0NTU5NzAwIiwiZXhwIjoi
|
||||
|
||||
## IMMEDIATE ITEMS
|
||||
|
||||
|
||||
Item below half done: widget picklist is done, might need test cleanup for that, user picklist needs to have code copied
|
||||
|
||||
Widget and user picklist, modify to use filter and sort criteria, remove the startswith built in filter
|
||||
- Fix up the old tests for picklists and replace with new test using filter ID
|
||||
- Don't forget to test with no filter ID to ensure still works as normal (default picklist should sort by alpha, need extra default method for sql query)
|
||||
|
||||
GetMany - have a look at the widget getmany code and the get picklist utility helper and see if there is a possibility of moving the getmany code into a helper similarly to picklist
|
||||
|
||||
ENUM
|
||||
- Need route to get enum values and lt by providing a lowercase name of the enum (used for building filter UI for enum types)
|
||||
- Client needs to pick enum value adn display localized
|
||||
@@ -110,6 +112,7 @@ TODO SERVER STUFF
|
||||
- Maybe a reference count for each tag to drive a tag cloud feature and also a order by commonality feature when offering and also to know when to remove the tag repository when no one is using that tag anymore in any records
|
||||
|
||||
- Boot server and seed with debug log turned on, see what is being tracked by EF that doesn't need to, seems some of that shit is being tracked.
|
||||
- Docs: pagingOptions, sort and filter need to be documented for API
|
||||
|
||||
-----------------
|
||||
|
||||
|
||||
@@ -133,52 +133,16 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// Get widget pick list
|
||||
// ///
|
||||
// /// Required roles: Any
|
||||
// ///
|
||||
// /// This list supports querying the Name property
|
||||
// /// include a "q" parameter for string to search for
|
||||
// /// use % for wildcards.
|
||||
// ///
|
||||
// /// e.g. q=%Jones%
|
||||
// ///
|
||||
// /// Query is case insensitive
|
||||
// /// </summary>
|
||||
// /// <returns>Paged id/name collection of widgets with paging data</returns>
|
||||
// [HttpGet("PickList", Name = nameof(WidgetPickList))]
|
||||
// public async Task<IActionResult> WidgetPickList([FromQuery] string q, [FromQuery] PagingOptions pagingOptions)
|
||||
// {
|
||||
// if (serverState.IsClosed)
|
||||
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
|
||||
// if (!ModelState.IsValid)
|
||||
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
// //Instantiate the business object handler
|
||||
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
// ApiPagedResponse<NameIdItem> pr = await biz.GetPickListAsync(Url, nameof(WidgetPickList), pagingOptions, q);
|
||||
// return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
|
||||
// }
|
||||
|
||||
/// <summary>
|
||||
/// Get widget pick list
|
||||
/// <summary>
|
||||
/// Get widget pick list
|
||||
///
|
||||
/// Required roles: Any
|
||||
///
|
||||
/// This list supports querying the Name property
|
||||
/// include a "q" parameter for string to search for
|
||||
/// use % for wildcards.
|
||||
///
|
||||
/// e.g. q=%Jones%
|
||||
///
|
||||
/// Query is case insensitive
|
||||
/// </summary>
|
||||
/// <returns>Paged id/name collection of widgets with paging data</returns>
|
||||
/// <param name="pagingOptions">Paging, filtering and sorting options</param>
|
||||
/// <returns>Paged id/name collection of widgets with paging data</returns>
|
||||
[HttpGet("PickList", Name = nameof(WidgetPickList))]
|
||||
public async Task<IActionResult> WidgetPickList([FromQuery] PagingOptions pagingOptions)
|
||||
public ActionResult WidgetPickList([FromQuery] PagingOptions pagingOptions)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
@@ -189,10 +153,10 @@ namespace AyaNova.Api.Controllers
|
||||
//Instantiate the business object handler
|
||||
WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
ApiPagedResponse<NameIdItem> pr = await biz.GetPickListAsync(Url, nameof(WidgetPickList), pagingOptions);
|
||||
ApiPagedResponse<NameIdItem> pr = biz.GetPickList(Url, nameof(WidgetPickList), pagingOptions);
|
||||
return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Put (update) widget
|
||||
|
||||
@@ -214,82 +214,11 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
//get picklist (paged)
|
||||
internal async Task<ApiPagedResponse<NameIdItem>> GetPickListAsync(IUrlHelper Url, string routeName, PagingOptions pagingOptions)
|
||||
internal ApiPagedResponse<NameIdItem> GetPickList(IUrlHelper Url, string routeName, PagingOptions pagingOptions)
|
||||
{
|
||||
pagingOptions.Offset = pagingOptions.Offset ?? PagingOptions.DefaultOffset;
|
||||
pagingOptions.Limit = pagingOptions.Limit ?? PagingOptions.DefaultLimit;
|
||||
|
||||
// NameIdItem[] items;
|
||||
// int totalRecordCount = 0;
|
||||
|
||||
// //BUILD THE QUERY
|
||||
// //base query
|
||||
// var q = "SELECT id, name FROM AWIDGET ";
|
||||
|
||||
// //GET THE FILTER / SORT
|
||||
// if (pagingOptions.DataFilterId > 0)
|
||||
// {
|
||||
// var TheFilter = await ct.DataFilter.FirstOrDefaultAsync(x => x.Id == pagingOptions.DataFilterId);
|
||||
|
||||
// //BUILD WHERE AND APPEND IT
|
||||
// q = q + FilterSqlCriteriaBuilder.DataFilterToSQLCriteria(TheFilter, WidgetBiz.FilterOptions(), UserId);
|
||||
|
||||
// //BUILD ORDER BY AND APPEND IT
|
||||
// q = q + FilterSqlOrderByBuilder.DataFilterToSQLOrderBy(TheFilter);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// //GET DEFAULT ORDER BY
|
||||
// q = q + FilterSqlOrderByBuilder.DefaultOrderBy();
|
||||
// }
|
||||
|
||||
|
||||
// #pragma warning disable EF1000
|
||||
|
||||
// var items = await ct.Widget
|
||||
// .AsNoTracking()
|
||||
// .FromSql(q)
|
||||
// .Skip(pagingOptions.Offset.Value)
|
||||
// .Take(pagingOptions.Limit.Value)
|
||||
// .ToArrayAsync();
|
||||
|
||||
// var totalRecordCount = await ct.Widget
|
||||
// .AsNoTracking()
|
||||
// .FromSql(q)
|
||||
// .CountAsync();
|
||||
// #pragma warning restore EF1000
|
||||
|
||||
// if (!string.IsNullOrWhiteSpace(q))
|
||||
// {
|
||||
// items = await ct.Widget
|
||||
// .AsNoTracking()
|
||||
// .Where(m => EF.Functions.ILike(m.Name, q))
|
||||
// .OrderBy(m => m.Name)
|
||||
// .Skip(pagingOptions.Offset.Value)
|
||||
// .Take(pagingOptions.Limit.Value)
|
||||
// .Select(m => new NameIdItem()
|
||||
// {
|
||||
// Id = m.Id,
|
||||
// Name = m.Name
|
||||
// }).ToArrayAsync();
|
||||
|
||||
// totalRecordCount = await ct.Widget.Where(m => EF.Functions.ILike(m.Name, q)).CountAsync();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// items = await ct.Widget
|
||||
// .AsNoTracking()
|
||||
// .OrderBy(m => m.Name)
|
||||
// .Skip(pagingOptions.Offset.Value)
|
||||
// .Take(pagingOptions.Limit.Value)
|
||||
// .Select(m => new NameIdItem()
|
||||
// {
|
||||
// Id = m.Id,
|
||||
// Name = m.Name
|
||||
// }).ToArrayAsync();
|
||||
|
||||
// totalRecordCount = await ct.Widget.CountAsync();
|
||||
// }
|
||||
|
||||
var ret = PickListFetcher.GetPickList(ct, UserId, pagingOptions, "awidget");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user