This commit is contained in:
@@ -46,15 +46,15 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get full DataFilter object
|
/// Get full DataListTemplate object
|
||||||
///
|
///
|
||||||
/// Required roles:
|
/// Required roles:
|
||||||
/// Any (for public filter), owned only for private filter
|
/// Any (for public filter), owned only for private filter
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns>A single DataFilter</returns>
|
/// <returns>A single DataListTemplate</returns>
|
||||||
[HttpGet("{id}")]
|
[HttpGet("{id}")]
|
||||||
public async Task<IActionResult> GetDataFilter([FromRoute] long id)
|
public async Task<IActionResult> GetDataListTemplate([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));
|
||||||
@@ -78,14 +78,14 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get DataFilter pick list
|
/// Get DataListTemplate pick list
|
||||||
///
|
///
|
||||||
/// Required roles: Any
|
/// Required roles: Any
|
||||||
///
|
///
|
||||||
/// </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(DataListTemplatePickList))]
|
||||||
public async Task<IActionResult> DataFilterPickList([FromQuery] string ListKey)
|
public async Task<IActionResult> DataListTemplatePickList([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));
|
||||||
@@ -103,7 +103,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Put (update) DataFilter
|
/// Put (update) DataListTemplate
|
||||||
///
|
///
|
||||||
/// Required roles:
|
/// Required roles:
|
||||||
/// Any (public filter) or owned only (private filter)
|
/// Any (public filter) or owned only (private filter)
|
||||||
@@ -113,7 +113,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <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] DataListTemplate inObj)
|
public async Task<IActionResult> PutDataListTemplate([FromRoute] long id, [FromBody] DataListTemplate 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));
|
||||||
@@ -148,7 +148,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Post DataFilter
|
/// Post DataListTemplate
|
||||||
///
|
///
|
||||||
/// Required roles:
|
/// Required roles:
|
||||||
/// BizAdminFull, InventoryFull, TechFull
|
/// BizAdminFull, InventoryFull, TechFull
|
||||||
@@ -157,7 +157,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <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] DataListTemplate inObj, ApiVersion apiVersion)
|
public async Task<IActionResult> PostDataListTemplate([FromBody] DataListTemplate 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));
|
||||||
@@ -177,14 +177,14 @@ 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(DataListTemplateController.GetDataFilter), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
return CreatedAtAction(nameof(DataListTemplateController.GetDataListTemplate), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete DataFilter
|
/// Delete DataListTemplate
|
||||||
///
|
///
|
||||||
/// Required roles:
|
/// Required roles:
|
||||||
/// Any if public otherwise creator only
|
/// Any if public otherwise creator only
|
||||||
@@ -193,7 +193,7 @@ namespace AyaNova.Api.Controllers
|
|||||||
/// <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> DeleteDataListTemplate([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));
|
||||||
|
|||||||
@@ -32,8 +32,9 @@ namespace AyaNova.Biz
|
|||||||
DEPRECATED_REUSELATER_15 = 15,
|
DEPRECATED_REUSELATER_15 = 15,
|
||||||
DEPRECATED_REUSELATER_16 = 16,
|
DEPRECATED_REUSELATER_16 = 16,
|
||||||
FileAttachment = 17,
|
FileAttachment = 17,
|
||||||
DataFilter = 18,
|
DataListFilter = 18,
|
||||||
FormCustom = 19
|
FormCustom = 19,
|
||||||
|
DataListTemplate = 20
|
||||||
|
|
||||||
|
|
||||||
//NOTE: New objects added here need to also be added to the following classes:
|
//NOTE: New objects added here need to also be added to the following classes:
|
||||||
|
|||||||
@@ -1,67 +1,70 @@
|
|||||||
using System.Linq;
|
// using System.Linq;
|
||||||
using System.Threading.Tasks;
|
// using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
// using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
// using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
// using Microsoft.AspNetCore.JsonPatch;
|
||||||
using EnumsNET;
|
// using EnumsNET;
|
||||||
using AyaNova.Util;
|
// using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
// using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Biz;
|
// using AyaNova.Biz;
|
||||||
using AyaNova.Models;
|
// using AyaNova.Models;
|
||||||
|
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
// namespace AyaNova.Biz
|
||||||
{
|
// {
|
||||||
|
|
||||||
|
|
||||||
//TODO: UNTESTED, UNUSED (SO FAR)CODE
|
// //TODO: UNTESTED, UNUSED (SO FAR)CODE
|
||||||
//This was just blocked out because I know I will need it in future
|
// //This was just blocked out because I know I will need it in future
|
||||||
internal static class BizObjectExistsInDatabase
|
//REALLY? I"M BALLS DEEP IN THIS AND HAVEN'T SEEN A NEED FOR IT YET, not updating or maintaining until I see a need
|
||||||
{
|
// internal static class BizObjectExistsInDatabase
|
||||||
|
// {
|
||||||
|
|
||||||
internal static bool Exists(AyaTypeId tid)
|
// internal static bool Exists(AyaTypeId tid)
|
||||||
{
|
// {
|
||||||
return Exists(tid.ObjectType, tid.ObjectId);
|
// return Exists(tid.ObjectType, tid.ObjectId);
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
//Returns existance status of object type and id specified in database
|
// //Returns existance status of object type and id specified in database
|
||||||
internal static bool Exists(AyaType aytype, long id, AyContext ct = null)
|
// internal static bool Exists(AyaType aytype, long id, AyContext ct = null)
|
||||||
{
|
// {
|
||||||
//new up a context??
|
// //new up a context??
|
||||||
if (ct == null)
|
// if (ct == null)
|
||||||
{
|
// {
|
||||||
ct = ServiceProviderProvider.DBContext;
|
// ct = ServiceProviderProvider.DBContext;
|
||||||
}
|
// }
|
||||||
switch (aytype)
|
// switch (aytype)
|
||||||
{
|
// {
|
||||||
case AyaType.User:
|
// case AyaType.User:
|
||||||
return ct.User.Any(m => m.Id == id);
|
// return ct.User.Any(m => m.Id == id);
|
||||||
case AyaType.Widget:
|
// case AyaType.Widget:
|
||||||
return ct.Widget.Any(m => m.Id == id);
|
// return ct.Widget.Any(m => m.Id == id);
|
||||||
case AyaType.FileAttachment:
|
// case AyaType.FileAttachment:
|
||||||
return ct.FileAttachment.Any(m => m.Id == id);
|
// return ct.FileAttachment.Any(m => m.Id == id);
|
||||||
case AyaType.DataFilter:
|
// case AyaType.DataListFilter:
|
||||||
return ct.DataListFilter.Any(m => m.Id == id);
|
// return ct.DataListFilter.Any(m => m.Id == id);
|
||||||
case AyaType.FormCustom:
|
// case AyaType.DataListTemplate:
|
||||||
return ct.FormCustom.Any(m => m.Id == id);
|
// return ct.DataListTemplate.Any(m => m.Id == id);
|
||||||
|
// case AyaType.FormCustom:
|
||||||
|
// return ct.FormCustom.Any(m => m.Id == id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
default:
|
// default:
|
||||||
throw new System.NotSupportedException($"AyaNova.BLL.BizObjectExistsInDatabase::Exists type {aytype.ToString()} is not supported");
|
// throw new System.NotSupportedException($"AyaNova.BLL.BizObjectExistsInDatabase::Exists type {aytype.ToString()} is not supported");
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////////
|
// /////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
}//eoc
|
// }//eoc
|
||||||
|
|
||||||
|
|
||||||
}//eons
|
// }//eons
|
||||||
|
|
||||||
|
|||||||
@@ -35,8 +35,10 @@ 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.DataFilter:
|
case AyaType.DataListFilter:
|
||||||
return new DataListFilterBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles);
|
return new DataListFilterBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles);
|
||||||
|
case AyaType.DataListTemplate:
|
||||||
|
return new DataListTemplateBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles);
|
||||||
case AyaType.FormCustom:
|
case AyaType.FormCustom:
|
||||||
return new FormCustomBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles);
|
return new FormCustomBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles);
|
||||||
|
|
||||||
|
|||||||
@@ -30,13 +30,17 @@ namespace AyaNova.Biz
|
|||||||
TABLE = "afileattachment";
|
TABLE = "afileattachment";
|
||||||
COLUMN = "displayfilename";
|
COLUMN = "displayfilename";
|
||||||
break;
|
break;
|
||||||
case AyaType.DataFilter:
|
case AyaType.DataListFilter:
|
||||||
TABLE = "adatafilter";
|
TABLE = "adatalistfilter";
|
||||||
break;
|
break;
|
||||||
case AyaType.FormCustom:
|
case AyaType.FormCustom:
|
||||||
TABLE = "aformcustom";
|
TABLE = "aformcustom";
|
||||||
COLUMN = "formkey";
|
COLUMN = "formkey";
|
||||||
break;
|
break;
|
||||||
|
case AyaType.DataListTemplate:
|
||||||
|
TABLE = "adatalisttemplate";
|
||||||
|
COLUMN = "datalistkey";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new System.NotSupportedException($"AyaNova.BLL.BizObjectNameFetcher::Name type {aytype.ToString()} is not supported");
|
throw new System.NotSupportedException($"AyaNova.BLL.BizObjectNameFetcher::Name type {aytype.ToString()} is not supported");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -133,9 +133,18 @@ namespace AyaNova.Biz
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
//DATAFILTER
|
//DATALISTFILTER
|
||||||
//
|
//
|
||||||
roles.Add(AyaType.DataFilter, new BizRoleSet()
|
roles.Add(AyaType.DataListFilter, new BizRoleSet()
|
||||||
|
{
|
||||||
|
Change = AuthorizationRoles.BizAdminFull,
|
||||||
|
ReadFullRecord = AuthorizationRoles.All
|
||||||
|
});
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
//DATALISTTEMPLATE
|
||||||
|
//
|
||||||
|
roles.Add(AyaType.DataListTemplate, new BizRoleSet()
|
||||||
{
|
{
|
||||||
Change = AuthorizationRoles.BizAdminFull,
|
Change = AuthorizationRoles.BizAdminFull,
|
||||||
ReadFullRecord = AuthorizationRoles.All
|
ReadFullRecord = AuthorizationRoles.All
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace AyaNova.Biz
|
|||||||
UserId = currentUserId;
|
UserId = currentUserId;
|
||||||
UserLocaleId = userLocaleId;
|
UserLocaleId = userLocaleId;
|
||||||
CurrentUserRoles = UserRoles;
|
CurrentUserRoles = UserRoles;
|
||||||
BizType = AyaType.DataFilter;
|
BizType = AyaType.DataListFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static DataListFilterBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)
|
internal static DataListFilterBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace AyaNova.Biz
|
|||||||
UserId = currentUserId;
|
UserId = currentUserId;
|
||||||
UserLocaleId = userLocaleId;
|
UserLocaleId = userLocaleId;
|
||||||
CurrentUserRoles = UserRoles;
|
CurrentUserRoles = UserRoles;
|
||||||
BizType = AyaType.DataFilter;
|
BizType = AyaType.DataListFilter;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static DataListTemplateBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)
|
internal static DataListTemplateBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)
|
||||||
|
|||||||
Reference in New Issue
Block a user