This commit is contained in:
@@ -41,7 +41,7 @@ UI FEATURE - The ability to customize forms:
|
|||||||
- Hide "hide"
|
- Hide "hide"
|
||||||
- Required "required"
|
- Required "required"
|
||||||
- Type One of values from AyDataType but not tags or enum (bool, date, date time, decimal, number, picklist(FUTURE), and text)
|
- 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
|
- #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
|
- 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>
|
/// <summary>
|
||||||
// /// Put (update) FormCustom
|
/// Put (update) FormCustom
|
||||||
// ///
|
///
|
||||||
// /// Required roles:
|
/// Required roles:
|
||||||
// /// Any (public filter) or owned only (private filter)
|
/// Any (public filter) or owned only (private filter)
|
||||||
// ///
|
///
|
||||||
// /// </summary>
|
/// </summary>
|
||||||
// /// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
// /// <param name="inObj"></param>
|
/// <param name="inObj"></param>
|
||||||
// /// <returns></returns>
|
/// <returns></returns>
|
||||||
// [HttpPut("{id}")]
|
[HttpPut("{id}")]
|
||||||
// public async Task<IActionResult> PutFormCustom([FromRoute] long id, [FromBody] FormCustom inObj)
|
public async Task<IActionResult> PutFormCustom([FromRoute] long id, [FromBody] FormCustom inObj)
|
||||||
// {
|
{
|
||||||
// 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));
|
||||||
|
|
||||||
// if (!ModelState.IsValid)
|
if (!ModelState.IsValid)
|
||||||
// return BadRequest(new ApiErrorResponse(ModelState));
|
return BadRequest(new ApiErrorResponse(ModelState));
|
||||||
|
|
||||||
// //Instantiate the business object handler
|
//Instantiate the business object handler
|
||||||
// FormCustomBiz biz = FormCustomBiz.GetBiz(ct, HttpContext);
|
FormCustomBiz biz = FormCustomBiz.GetBiz(ct, HttpContext);
|
||||||
|
|
||||||
// var o = await biz.GetNoLogAsync(id);
|
var o = await biz.GetNoLogAsync(id);
|
||||||
// if (o == null)
|
if (o == null)
|
||||||
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||||
|
|
||||||
// if (!Authorized.IsAuthorizedToModify(HttpContext.Items, biz.BizType, o.OwnerId))
|
if (!Authorized.IsAuthorizedToModify(HttpContext.Items, biz.BizType, o.OwnerId))
|
||||||
// return StatusCode(401, new ApiNotAuthorizedResponse());
|
return StatusCode(401, new ApiNotAuthorizedResponse());
|
||||||
|
|
||||||
// try
|
try
|
||||||
// {
|
{
|
||||||
// if (!biz.Put(o, inObj))
|
if (!biz.Put(o, inObj))
|
||||||
// return BadRequest(new ApiErrorResponse(biz.Errors));
|
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||||
// }
|
}
|
||||||
// catch (DbUpdateConcurrencyException)
|
catch (DbUpdateConcurrencyException)
|
||||||
// {
|
{
|
||||||
// if (!await biz.ExistsAsync(id))
|
if (!await biz.ExistsAsync(id))
|
||||||
// return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||||
// else
|
else
|
||||||
// return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
|
return StatusCode(409, new ApiErrorResponse(ApiErrorCode.CONCURRENCY_CONFLICT));
|
||||||
// }
|
}
|
||||||
// return Ok(new ApiOkResponse(new { ConcurrencyToken = o.ConcurrencyToken }));
|
return Ok(new ApiOkResponse(new { ConcurrencyToken = o.ConcurrencyToken }));
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -434,7 +434,7 @@ namespace AyaNova
|
|||||||
//to support html5 pushstate routing in spa
|
//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
|
//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();
|
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.Request.Path = "/index.html";
|
||||||
context.Response.StatusCode = 200;
|
context.Response.StatusCode = 200;
|
||||||
|
|||||||
@@ -80,21 +80,21 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/// GET
|
/// GET
|
||||||
|
|
||||||
//Get one
|
//Get one
|
||||||
internal async Task<FormCustom> GetAsync(string formKey)
|
internal async Task<FormCustom> GetAsync(string formKey)
|
||||||
{
|
{
|
||||||
var ret = await ct.FormCustom.SingleOrDefaultAsync(m => m.FormKey == 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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -128,7 +128,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//NO DELETE, ONLY EDIT
|
//NO DELETE, ONLY EDIT
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//VALIDATION
|
//VALIDATION
|
||||||
@@ -167,7 +167,7 @@ namespace AyaNova.Biz
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Template json must parse
|
//Template json must parse
|
||||||
if (!string.IsNullOrWhiteSpace(inObj.Template))
|
if (!string.IsNullOrWhiteSpace(inObj.Template))
|
||||||
@@ -176,6 +176,11 @@ namespace AyaNova.Biz
|
|||||||
{
|
{
|
||||||
var v = JArray.Parse(inObj.Template);
|
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:
|
//Validate the following:
|
||||||
//FormKey is valid value
|
//FormKey is valid value
|
||||||
//All fields specified are valid values
|
//All fields specified are valid values
|
||||||
@@ -266,7 +271,7 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user