This commit is contained in:
2020-08-06 18:06:23 +00:00
parent 151c2fbb72
commit bedb64f9d5
3 changed files with 25 additions and 2 deletions

2
.vscode/launch.json vendored
View File

@@ -51,7 +51,7 @@
"AYANOVA_USE_URLS": "http://*:7575;",
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_SERVER_TEST_MODE":"true",
"AYANOVA_SERVER_TEST_MODE":"false",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL":"small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET":"-7",
"AYANOVA_BACKUP_PG_DUMP_PATH":"C:\\data\\code\\PostgreSQLPortable_12.0\\App\\PgSQL\\bin\\"

View File

@@ -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));
}
//------------

View File

@@ -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)]