This commit is contained in:
@@ -7,10 +7,7 @@
|
|||||||
|
|
||||||
//PICKLISTS:
|
//PICKLISTS:
|
||||||
|
|
||||||
|
todo: rename datalistview controller and objects "PickList" to something non-clashy
|
||||||
todo: clean out unneeded leftovers from AyaPickListFieldDefinition
|
|
||||||
todo: add pickers for all CORE objects (User...?)
|
|
||||||
todo: write a guide in ayatype for what to do when making a new core object as there are a few things now
|
|
||||||
todo: tests once it's all completed for server
|
todo: tests once it's all completed for server
|
||||||
- test regular, tags, non-text column, max-results, order, template routes etc
|
- test regular, tags, non-text column, max-results, order, template routes etc
|
||||||
- test not authorized, not found
|
- test not authorized, not found
|
||||||
|
|||||||
@@ -101,7 +101,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ayaType"></param>
|
/// <param name="ayaType"></param>
|
||||||
/// <returns>The current effective template, either a customized one or the default</returns>
|
/// <returns>The current effective template, either a customized one or the default</returns>
|
||||||
[HttpGet("Template/{ayatype}")]
|
[HttpGet("Template/{ayaType}")]
|
||||||
public async Task<IActionResult> GetPickListTemplate([FromRoute] AyaType ayaType)
|
public async Task<IActionResult> GetPickListTemplate([FromRoute] AyaType ayaType)
|
||||||
{
|
{
|
||||||
if (serverState.IsClosed)
|
if (serverState.IsClosed)
|
||||||
@@ -154,12 +154,12 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// POST (replace) Pick List template
|
/// POST (replace) Pick List template
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ayaType"></param>
|
|
||||||
/// <param name="template"></param>
|
/// <param name="template"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("Template/{ayatype}")]
|
// [HttpPost("Template/{ayaType}")]
|
||||||
public async Task<IActionResult> ReplacePickListTemplate([FromRoute] AyaType ayaType, [FromBody] string template)
|
[HttpPost("Template")]
|
||||||
|
public async Task<IActionResult> ReplacePickListTemplate([FromBody] PickListTemplate template)
|
||||||
{
|
{
|
||||||
if (!serverState.IsOpen)
|
if (!serverState.IsOpen)
|
||||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||||
@@ -179,7 +179,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!await biz.ReplaceAsync(ayaType, template))
|
if (!await biz.ReplaceAsync(template))
|
||||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
}
|
}
|
||||||
catch (DbUpdateConcurrencyException)
|
catch (DbUpdateConcurrencyException)
|
||||||
@@ -197,7 +197,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ayaType"></param>
|
/// <param name="ayaType"></param>
|
||||||
/// <returns>Ok</returns>
|
/// <returns>Ok</returns>
|
||||||
[HttpDelete("Template/{ayatype}")]
|
[HttpDelete("Template/{ayaType}")]
|
||||||
public async Task<IActionResult> DeletePickListTemplate([FromRoute] AyaType ayaType)
|
public async Task<IActionResult> DeletePickListTemplate([FromRoute] AyaType ayaType)
|
||||||
{
|
{
|
||||||
if (!serverState.IsOpen)
|
if (!serverState.IsOpen)
|
||||||
@@ -224,7 +224,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// List of all fields for pick list AyaType specified
|
/// List of all fields for pick list AyaType specified
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>List of fields available for template</returns>
|
/// <returns>List of fields available for template</returns>
|
||||||
[HttpGet("Template/ListFields/{ayatype}")]
|
[HttpGet("Template/ListFields/{ayaType}")]
|
||||||
public ActionResult GetPickListFields([FromRoute] AyaType ayaType)
|
public ActionResult GetPickListFields([FromRoute] AyaType ayaType)
|
||||||
{
|
{
|
||||||
if (!serverState.IsOpen)
|
if (!serverState.IsOpen)
|
||||||
|
|||||||
@@ -152,15 +152,15 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
|
|
||||||
//put
|
//put
|
||||||
internal async Task<bool> ReplaceAsync(AyaType ayaType, string template)
|
internal async Task<bool> ReplaceAsync(PickListTemplate template)
|
||||||
{
|
{
|
||||||
var o = await ct.PickListTemplate.FirstOrDefaultAsync(m => m.Id == (long)ayaType);
|
var o = await ct.PickListTemplate.FirstOrDefaultAsync(m => m.Id == (long)template.Id);
|
||||||
if (o == null)
|
if (o == null)
|
||||||
{
|
{
|
||||||
o = new PickListTemplate();
|
o = new PickListTemplate();
|
||||||
}
|
}
|
||||||
o.Id = (long)ayaType;
|
o.Id = (long)template.Id;
|
||||||
o.Template = template;
|
o.Template = template.Template;
|
||||||
|
|
||||||
|
|
||||||
Validate(o);
|
Validate(o);
|
||||||
|
|||||||
Reference in New Issue
Block a user