This commit is contained in:
@@ -92,8 +92,8 @@ namespace AyaNova.Api.Controllers
|
||||
/// </summary>
|
||||
/// <param name="pagingOptions">Paging, filtering and sorting options</param>
|
||||
/// <returns>Collection with paging data</returns>
|
||||
[HttpGet("List", Name = nameof(WidgetList))]
|
||||
public ActionResult WidgetList([FromQuery] ListOptions pagingOptions)
|
||||
[HttpGet("List", Name = nameof(List))]
|
||||
public ActionResult List([FromQuery] ListOptions pagingOptions)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
@@ -106,8 +106,8 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
// ApiPagedResponse<NameIdItem> pr = biz.GetList(Url, nameof(WidgetList), pagingOptions);
|
||||
// return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
|
||||
JObject j = biz.GetList(Url, nameof(WidgetList), pagingOptions).Result;
|
||||
return Ok(j);
|
||||
string ret= biz.GetList(Url, nameof(List), pagingOptions).Result;
|
||||
return Ok(ret);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace AyaNova.Biz
|
||||
{
|
||||
//************************************************
|
||||
// This contains all the fields that are:
|
||||
// Customizable on forms
|
||||
// In grid list templates
|
||||
// - Customizable on forms
|
||||
// - In grid list templates
|
||||
//In addition it serves as a source for valid object keys in AvailableObjectKeys
|
||||
//
|
||||
public static class ObjectFields
|
||||
@@ -110,7 +111,7 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
default:
|
||||
throw new System.ArgumentOutOfRangeException($"ObjectFields: {key} is not a valid form key");
|
||||
throw new System.ArgumentOutOfRangeException($"ObjectFields: {key} is not a valid object key");
|
||||
}
|
||||
return l;
|
||||
}
|
||||
@@ -128,6 +129,18 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
//Accept a json template
|
||||
//return a column list suitable for api list return
|
||||
public static string GenerateListColumnJSONFromTemplate(string ObjectKey, string template)
|
||||
{
|
||||
//parse the template
|
||||
var jtemplate = JObject.Parse(template);
|
||||
var fields= ObjectFieldsList(ObjectKey);
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
}//eoc ObjectFields
|
||||
|
||||
@@ -146,7 +159,7 @@ namespace AyaNova.Biz
|
||||
public string EnumType { get; set; }
|
||||
//if field is a reference to another object (i.e. a client in a workorders list)
|
||||
//then the type to open is set here
|
||||
public int AyObjectType {get;set;}
|
||||
public int AyObjectType { get; set; }
|
||||
|
||||
|
||||
public ObjectField()
|
||||
@@ -159,7 +172,7 @@ namespace AyaNova.Biz
|
||||
Sortable = true;
|
||||
MiniAvailable = true;
|
||||
//Set openable object type to no type which is the default and means it's not a link to another object
|
||||
AyObjectType=(int)AyaType.NoType;
|
||||
AyObjectType = (int)AyaType.NoType;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -270,7 +270,7 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
//get many (paged)
|
||||
internal async Task<JObject> GetList(IUrlHelper Url, string routeName, ListOptions listOptions)
|
||||
internal async Task<string> GetList(IUrlHelper Url, string routeName, ListOptions listOptions)
|
||||
{
|
||||
listOptions.Offset = listOptions.Offset ?? ListOptions.DefaultOffset;
|
||||
listOptions.Limit = listOptions.Limit ?? ListOptions.DefaultLimit;
|
||||
@@ -336,7 +336,7 @@ namespace AyaNova.Biz
|
||||
//all mini lists will have an id so include the type to open
|
||||
ColumnsJSON=@"{[ {""cm"":""Widget"",""dt"":""text"",""ay"":"+ AyaType.Widget.ToString()+ "}]}";
|
||||
}else{
|
||||
ColumnsJSON=@"{[ {""cm"":""Widget"",""dt"":""text"",""ay"":"+ AyaType.Widget.ToString()+ "}]}";
|
||||
ColumnsJSON=ObjectFields.GenerateListColumnJSONFromTemplate(ObjectFields.WIDGET_KEY,MOCK_WIDGET_DISPLAY_TEMPLATE_JSON);
|
||||
}
|
||||
|
||||
//TODO: BUILD THE RETURN LIST OF DATA ITEMS
|
||||
@@ -350,8 +350,9 @@ namespace AyaNova.Biz
|
||||
dynamic ret = new JObject();
|
||||
ret.items = items;
|
||||
ret.pageLinks = pageLinks;
|
||||
ret.columns=ColumnsJSON;
|
||||
|
||||
return ret;
|
||||
return ret.ToString();
|
||||
// ApiPagedResponse<Widget> pr = new ApiPagedResponse<Widget>(items, pageLinks);
|
||||
// return pr;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user