This commit is contained in:
@@ -41,7 +41,7 @@ UI FEATURE - The ability to customize forms:
|
||||
- Hide "hide"
|
||||
- Required "required"
|
||||
- Type One of values from AyDataType but not tags or enum (bool, date, date time, decimal, number, picklist(FUTURE), and text)
|
||||
- e.g.: {fields:[{fld:"ltkeyoffieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"dollarAmount",lt:"WidgetDollarAmount",type:"currency"}]}
|
||||
- e.g.: {template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
|
||||
|
||||
- #DONE# Need a FormAvailableFields static collection class that contains the fields available to each form
|
||||
- This should be independent from any other class tied to a particular route or controller or db table as it could be some or none of all of those things
|
||||
|
||||
@@ -128,49 +128,49 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
|
||||
|
||||
// /// <summary>
|
||||
// /// Put (update) FormCustom
|
||||
// ///
|
||||
// /// Required roles:
|
||||
// /// Any (public filter) or owned only (private filter)
|
||||
// ///
|
||||
// /// </summary>
|
||||
// /// <param name="id"></param>
|
||||
// /// <param name="inObj"></param>
|
||||
// /// <returns></returns>
|
||||
// [HttpPut("{id}")]
|
||||
// public async Task<IActionResult> PutFormCustom([FromRoute] long id, [FromBody] FormCustom inObj)
|
||||
// {
|
||||
// if (!serverState.IsOpen)
|
||||
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
/// <summary>
|
||||
/// Put (update) FormCustom
|
||||
///
|
||||
/// Required roles:
|
||||
/// Any (public filter) or owned only (private filter)
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="inObj"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPut("{id}")]
|
||||
public async Task<IActionResult> PutFormCustom([FromRoute] long id, [FromBody] FormCustom inObj)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
|
||||
|
||||
// if (!ModelState.IsValid)
|
||||
// return BadRequest(new ApiErrorResponse(ModelState));
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
// //Instantiate the business object handler
|
||||
// FormCustomBiz biz = FormCustomBiz.GetBiz(ct, HttpContext);
|
||||
//Instantiate the business object handler
|
||||
FormCustomBiz biz = FormCustomBiz.GetBiz(ct, HttpContext);
|
||||
|
||||
// var o = await biz.GetNoLogAsync(id);
|
||||
// if (o == null)
|
||||
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
var o = await biz.GetNoLogAsync(id);
|
||||
if (o == null)
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
|
||||
// if (!Authorized.IsAuthorizedToModify(HttpContext.Items, biz.BizType, o.OwnerId))
|
||||
// return StatusCode(401, new ApiNotAuthorizedResponse());
|
||||
if (!Authorized.IsAuthorizedToModify(HttpContext.Items, biz.BizType, o.OwnerId))
|
||||
return StatusCode(401, new ApiNotAuthorizedResponse());
|
||||
|
||||
// try
|
||||
// {
|
||||
// if (!biz.Put(o, inObj))
|
||||
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
// }
|
||||
// catch (DbUpdateConcurrencyException)
|
||||
// {
|
||||
// if (!await biz.ExistsAsync(id))
|
||||
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
// else
|
||||
// return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
|
||||
// }
|
||||
// return Ok(new ApiOkResponse(new { ConcurrencyToken = o.ConcurrencyToken }));
|
||||
// }
|
||||
try
|
||||
{
|
||||
if (!biz.Put(o, inObj))
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
}
|
||||
catch (DbUpdateConcurrencyException)
|
||||
{
|
||||
if (!await biz.ExistsAsync(id))
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
else
|
||||
return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
|
||||
}
|
||||
return Ok(new ApiOkResponse(new { ConcurrencyToken = o.ConcurrencyToken }));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -434,7 +434,7 @@ namespace AyaNova
|
||||
//to support html5 pushstate routing in spa
|
||||
//this ensures that a refresh at the client will not 404 but rather force back to the index.html app page and then handled internally by the client
|
||||
await next();
|
||||
if (context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
|
||||
if (!context.Response.HasStarted && context.Request.Path.Value != "/docs" && context.Response.StatusCode == 404 && !Path.HasExtension(context.Request.Path.Value))
|
||||
{
|
||||
context.Request.Path = "/index.html";
|
||||
context.Response.StatusCode = 200;
|
||||
|
||||
@@ -80,21 +80,21 @@ namespace AyaNova.Biz
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
/// GET
|
||||
|
||||
//Get one
|
||||
internal async Task<FormCustom> GetAsync(string formKey)
|
||||
{
|
||||
{
|
||||
var ret = await ct.FormCustom.SingleOrDefaultAsync(m => m.FormKey == formKey);
|
||||
//Do not log this, it's going to be called a zillion times anyway
|
||||
//Do not log this, it's going to be called a zillion times anyway
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@@ -128,7 +128,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
|
||||
//NO DELETE, ONLY EDIT
|
||||
//NO DELETE, ONLY EDIT
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//VALIDATION
|
||||
@@ -167,7 +167,7 @@ namespace AyaNova.Biz
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//Template json must parse
|
||||
if (!string.IsNullOrWhiteSpace(inObj.Template))
|
||||
@@ -176,6 +176,11 @@ namespace AyaNova.Biz
|
||||
{
|
||||
var v = JArray.Parse(inObj.Template);
|
||||
|
||||
/*
|
||||
Example:
|
||||
{template:[{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"bool"},{fld:"ltkeyfieldname",hide:"true/false",required:"true/false", type:"text"]}
|
||||
*/
|
||||
|
||||
//Validate the following:
|
||||
//FormKey is valid value
|
||||
//All fields specified are valid values
|
||||
@@ -266,7 +271,7 @@ namespace AyaNova.Biz
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user