This commit is contained in:
2020-02-12 18:07:14 +00:00
parent e531a913f8
commit e4c2b3cec8
11 changed files with 36 additions and 36 deletions

View File

@@ -24,10 +24,10 @@ namespace AyaNova.Api.Controllers
[Route("api/v{version:apiVersion}/[controller]")] [Route("api/v{version:apiVersion}/[controller]")]
[Produces("application/json")] [Produces("application/json")]
[Authorize] [Authorize]
public class DataListFilterController : ControllerBase public class DataListSortFilterController : ControllerBase
{ {
private readonly AyContext ct; private readonly AyContext ct;
private readonly ILogger<DataListFilterController> log; private readonly ILogger<DataListSortFilterController> log;
private readonly ApiServerState serverState; private readonly ApiServerState serverState;
@@ -37,7 +37,7 @@ namespace AyaNova.Api.Controllers
/// <param name="dbcontext"></param> /// <param name="dbcontext"></param>
/// <param name="logger"></param> /// <param name="logger"></param>
/// <param name="apiServerState"></param> /// <param name="apiServerState"></param>
public DataListFilterController(AyContext dbcontext, ILogger<DataListFilterController> logger, ApiServerState apiServerState) public DataListSortFilterController(AyContext dbcontext, ILogger<DataListSortFilterController> logger, ApiServerState apiServerState)
{ {
ct = dbcontext; ct = dbcontext;
log = logger; log = logger;
@@ -46,18 +46,18 @@ namespace AyaNova.Api.Controllers
/// <summary> /// <summary>
/// Get full DataFilter object /// Get full DataListSortFilter object
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns>A single DataFilter</returns> /// <returns>A single DataFilter</returns>
[HttpGet("{id}")] [HttpGet("{id}")]
public async Task<IActionResult> GetDataFilter([FromRoute] long id) public async Task<IActionResult> GetDataListSortFilter([FromRoute] long id)
{ {
if (serverState.IsClosed) if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
//Instantiate the business object handler //Instantiate the business object handler
DataListFilterBiz biz = DataListFilterBiz.GetBiz(ct, HttpContext); DataListSortFilterBiz biz = DataListSortFilterBiz.GetBiz(ct, HttpContext);
if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType)) if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
return StatusCode(403, new ApiNotAuthorizedResponse()); return StatusCode(403, new ApiNotAuthorizedResponse());
@@ -75,11 +75,11 @@ namespace AyaNova.Api.Controllers
/// <summary> /// <summary>
/// Get DataFilter pick list /// Get DataListSortFilter pick list
/// </summary> /// </summary>
/// <returns>List of public or owned data filters for listKey provided</returns> /// <returns>List of public or owned data filters for listKey provided</returns>
[HttpGet("PickList", Name = nameof(DataFilterPickList))] [HttpGet("PickList", Name = nameof(DataListSortFilterPickList))]
public async Task<IActionResult> DataFilterPickList([FromQuery] string ListKey) public async Task<IActionResult> DataListSortFilterPickList([FromQuery] string ListKey)
{ {
if (serverState.IsClosed) if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
@@ -88,7 +88,7 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ModelState)); return BadRequest(new ApiErrorResponse(ModelState));
//Instantiate the business object handler //Instantiate the business object handler
DataListFilterBiz biz = DataListFilterBiz.GetBiz(ct, HttpContext); DataListSortFilterBiz biz = DataListSortFilterBiz.GetBiz(ct, HttpContext);
var l = await biz.GetPickListAsync(ListKey); var l = await biz.GetPickListAsync(ListKey);
return Ok(ApiOkResponse.Response(l, true)); return Ok(ApiOkResponse.Response(l, true));
@@ -97,13 +97,13 @@ namespace AyaNova.Api.Controllers
/// <summary> /// <summary>
/// Put (update) DataFilter /// Put (update) DataListSortFilter
/// </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> PutDataFilter([FromRoute] long id, [FromBody] DataListSortFilter inObj) public async Task<IActionResult> PutDataListSortFilter([FromRoute] long id, [FromBody] DataListSortFilter 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));
@@ -112,7 +112,7 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ModelState)); return BadRequest(new ApiErrorResponse(ModelState));
//Instantiate the business object handler //Instantiate the business object handler
DataListFilterBiz biz = DataListFilterBiz.GetBiz(ct, HttpContext); DataListSortFilterBiz biz = DataListSortFilterBiz.GetBiz(ct, HttpContext);
var o = await biz.GetAsync(id, false); var o = await biz.GetAsync(id, false);
if (o == null) if (o == null)
@@ -138,19 +138,19 @@ namespace AyaNova.Api.Controllers
/// <summary> /// <summary>
/// Post DataFilter /// Post DataListSortFilter
/// </summary> /// </summary>
/// <param name="inObj"></param> /// <param name="inObj"></param>
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param> /// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
/// <returns></returns> /// <returns></returns>
[HttpPost] [HttpPost]
public async Task<IActionResult> PostDataFilter([FromBody] DataListSortFilter inObj, ApiVersion apiVersion) public async Task<IActionResult> PostDataListSortFilter([FromBody] DataListSortFilter inObj, ApiVersion apiVersion)
{ {
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));
//Instantiate the business object handler //Instantiate the business object handler
DataListFilterBiz biz = DataListFilterBiz.GetBiz(ct, HttpContext); DataListSortFilterBiz biz = DataListSortFilterBiz.GetBiz(ct, HttpContext);
//check roles //check roles
if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType)) if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
@@ -164,19 +164,19 @@ namespace AyaNova.Api.Controllers
if (o == null) if (o == null)
return BadRequest(new ApiErrorResponse(biz.Errors)); return BadRequest(new ApiErrorResponse(biz.Errors));
else else
return CreatedAtAction(nameof(DataListFilterController.GetDataFilter), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o)); return CreatedAtAction(nameof(DataListSortFilterController.GetDataListSortFilter), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
} }
/// <summary> /// <summary>
/// Delete DataFilter /// Delete DataListSortFilter
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns>Ok</returns> /// <returns>Ok</returns>
[HttpDelete("{id}")] [HttpDelete("{id}")]
public async Task<IActionResult> DeleteDataFilter([FromRoute] long id) public async Task<IActionResult> DeleteDataListSortFilter([FromRoute] long id)
{ {
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));
@@ -185,7 +185,7 @@ namespace AyaNova.Api.Controllers
return BadRequest(new ApiErrorResponse(ModelState)); return BadRequest(new ApiErrorResponse(ModelState));
//Instantiate the business object handler //Instantiate the business object handler
DataListFilterBiz biz = DataListFilterBiz.GetBiz(ct, HttpContext); DataListSortFilterBiz biz = DataListSortFilterBiz.GetBiz(ct, HttpContext);
var o = await biz.GetAsync(id, false); var o = await biz.GetAsync(id, false);
if (o == null) if (o == null)

View File

@@ -159,7 +159,7 @@ namespace AyaNova
} }
// NLog: setup the logger first to catch all errors // NLog: setup the logger first to catch all errors
var logger = NLogBuilder.ConfigureNLog(logConfig).GetCurrentClassLogger(); var logger = NLogBuilder.ConfigureNLog(logConfig).GetLogger("Server");//.GetCurrentClassLogger();
//This is the first log entry //This is the first log entry
logger.Info("AYANOVA SERVER BOOTING (log level: \"{0}\")", ServerBootConfig.AYANOVA_LOG_LEVEL); logger.Info("AYANOVA SERVER BOOTING (log level: \"{0}\")", ServerBootConfig.AYANOVA_LOG_LEVEL);

View File

@@ -35,7 +35,7 @@ namespace AyaNova
var nlogLoggerProvider = new NLogLoggerProvider(); var nlogLoggerProvider = new NLogLoggerProvider();
// Create an ILogger. // Create an ILogger.
_newLog = nlogLoggerProvider.CreateLogger("SRVR"); _newLog = nlogLoggerProvider.CreateLogger("Server");
//x_log = logger; //x_log = logger;
_hostingEnvironment = hostingEnvironment; _hostingEnvironment = hostingEnvironment;

View File

@@ -32,7 +32,7 @@ namespace AyaNova.Biz
DEPRECATED_REUSELATER_15 = 15, DEPRECATED_REUSELATER_15 = 15,
DEPRECATED_REUSELATER_16 = 16, DEPRECATED_REUSELATER_16 = 16,
FileAttachment = 17, FileAttachment = 17,
DataListFilter = 18, DataListSortFilter = 18,
FormCustom = 19, FormCustom = 19,
DataListTemplate = 20 DataListTemplate = 20

View File

@@ -36,7 +36,7 @@ namespace AyaNova.Biz
return await ct.Widget.AnyAsync(m => m.Id == id); return await ct.Widget.AnyAsync(m => m.Id == id);
case AyaType.FileAttachment: case AyaType.FileAttachment:
return await ct.FileAttachment.AnyAsync(m => m.Id == id); return await ct.FileAttachment.AnyAsync(m => m.Id == id);
case AyaType.DataListFilter: case AyaType.DataListSortFilter:
return await ct.DataListSortFilter.AnyAsync(m => m.Id == id); return await ct.DataListSortFilter.AnyAsync(m => m.Id == id);
case AyaType.DataListTemplate: case AyaType.DataListTemplate:
return await ct.DataListTemplate.AnyAsync(m => m.Id == id); return await ct.DataListTemplate.AnyAsync(m => m.Id == id);

View File

@@ -35,8 +35,8 @@ namespace AyaNova.Biz
return new TrialBiz(dbcontext, userId, roles); return new TrialBiz(dbcontext, userId, roles);
case AyaType.Locale: case AyaType.Locale:
return new LocaleBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles); return new LocaleBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles);
case AyaType.DataListFilter: case AyaType.DataListSortFilter:
return new DataListFilterBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles); return new DataListSortFilterBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles);
case AyaType.DataListTemplate: case AyaType.DataListTemplate:
return new DataListTemplateBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles); return new DataListTemplateBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles);
case AyaType.FormCustom: case AyaType.FormCustom:

View File

@@ -30,8 +30,8 @@ namespace AyaNova.Biz
TABLE = "afileattachment"; TABLE = "afileattachment";
COLUMN = "displayfilename"; COLUMN = "displayfilename";
break; break;
case AyaType.DataListFilter: case AyaType.DataListSortFilter:
TABLE = "adatalistfilter"; TABLE = "adatalistsortfilter";
break; break;
case AyaType.FormCustom: case AyaType.FormCustom:
TABLE = "aformcustom"; TABLE = "aformcustom";

View File

@@ -133,7 +133,7 @@ namespace AyaNova.Biz
//////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////
//DATALISTFILTER //DATALISTFILTER
// //
roles.Add(AyaType.DataListFilter, new BizRoleSet() roles.Add(AyaType.DataListSortFilter, new BizRoleSet()
{ {
Change = AuthorizationRoles.BizAdminFull, Change = AuthorizationRoles.BizAdminFull,
ReadFullRecord = AuthorizationRoles.All ReadFullRecord = AuthorizationRoles.All

View File

@@ -13,21 +13,21 @@ namespace AyaNova.Biz
{ {
internal class DataListFilterBiz : BizObject internal class DataListSortFilterBiz : BizObject
{ {
internal DataListFilterBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles UserRoles) internal DataListSortFilterBiz(AyContext dbcontext, long currentUserId, long userLocaleId, AuthorizationRoles UserRoles)
{ {
ct = dbcontext; ct = dbcontext;
UserId = currentUserId; UserId = currentUserId;
UserLocaleId = userLocaleId; UserLocaleId = userLocaleId;
CurrentUserRoles = UserRoles; CurrentUserRoles = UserRoles;
BizType = AyaType.DataListFilter; BizType = AyaType.DataListSortFilter;
} }
internal static DataListFilterBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext) internal static DataListSortFilterBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)
{ {
return new DataListFilterBiz(ct, UserIdFromContext.Id(httpContext.Items), UserLocaleIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items)); return new DataListSortFilterBiz(ct, UserIdFromContext.Id(httpContext.Items), UserLocaleIdFromContext.Id(httpContext.Items), UserRolesFromContext.Roles(httpContext.Items));
} }
// //Version for internal use // //Version for internal use

View File

@@ -21,7 +21,7 @@ namespace AyaNova.Biz
UserId = currentUserId; UserId = currentUserId;
UserLocaleId = userLocaleId; UserLocaleId = userLocaleId;
CurrentUserRoles = UserRoles; CurrentUserRoles = UserRoles;
BizType = AyaType.DataListFilter; BizType = AyaType.DataListSortFilter;
} }
internal static DataListTemplateBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext) internal static DataListTemplateBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)

View File

@@ -288,7 +288,7 @@ namespace AyaNova.Util
await EraseTableAsync("afileattachment", conn); await EraseTableAsync("afileattachment", conn);
await EraseTableAsync("awidget", conn); await EraseTableAsync("awidget", conn);
await EraseTableAsync("aevent", conn); await EraseTableAsync("aevent", conn);
await EraseTableAsync("adatalistfilter", conn); await EraseTableAsync("adatalistsortfilter", conn);
await EraseTableAsync("adatalisttemplate", conn); await EraseTableAsync("adatalisttemplate", conn);
await EraseTableAsync("aformcustom", conn); await EraseTableAsync("aformcustom", conn);
await EraseTableAsync("asearchkey", conn); await EraseTableAsync("asearchkey", conn);