This commit is contained in:
@@ -179,7 +179,29 @@ namespace AyaNova.Api.Controllers
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get FormKey from id of FormCustom
|
||||
/// </summary>
|
||||
/// <returns>A formKey string if id found</returns>
|
||||
[HttpGet("form-key/{id}")]
|
||||
public async Task<IActionResult> GetFormKeyFromId(long id)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, AyaType.FormCustom))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
|
||||
var fc = await ct.FormCustom.FirstOrDefaultAsync(z => z.Id == id);
|
||||
if (fc == null)
|
||||
{
|
||||
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
}
|
||||
return Ok(ApiOkResponse.Response(fc.FormKey));
|
||||
}
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace AyaNova.Models
|
||||
{
|
||||
|
||||
/*
|
||||
## NOTE: there is only one formcustom per ayatype, the formkey is the ayatype enum name
|
||||
|
||||
- Like DataFilter, holds a JSON fragment in one field and the form key in another field
|
||||
- JSON FRAGMENT holds items that differ from stock, Hide not valid for non hideable core fields
|
||||
@@ -16,7 +17,7 @@ namespace AyaNova.Models
|
||||
*/
|
||||
public class FormCustom
|
||||
{
|
||||
public long Id { get; set; }
|
||||
public long Id { get; set; }//Only one formcustom per object type
|
||||
public uint Concurrency { get; set; }
|
||||
|
||||
[Required, MaxLength(255)]
|
||||
|
||||
Reference in New Issue
Block a user