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));
|
||||
}
|
||||
|
||||
|
||||
//------------
|
||||
|
||||
Reference in New Issue
Block a user