diff --git a/server/AyaNova/Controllers/DataListTemplateController.cs b/server/AyaNova/Controllers/DataListTemplateController.cs index ff35661d..21c796df 100644 --- a/server/AyaNova/Controllers/DataListTemplateController.cs +++ b/server/AyaNova/Controllers/DataListTemplateController.cs @@ -46,15 +46,15 @@ namespace AyaNova.Api.Controllers /// - /// Get full DataFilter object + /// Get full DataListTemplate object /// /// Required roles: /// Any (for public filter), owned only for private filter /// /// - /// A single DataFilter + /// A single DataListTemplate [HttpGet("{id}")] - public async Task GetDataFilter([FromRoute] long id) + public async Task GetDataListTemplate([FromRoute] long id) { if (serverState.IsClosed) return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); @@ -78,14 +78,14 @@ namespace AyaNova.Api.Controllers /// - /// Get DataFilter pick list + /// Get DataListTemplate pick list /// /// Required roles: Any /// /// /// List of public or owned data filters for listKey provided - [HttpGet("PickList", Name = nameof(DataFilterPickList))] - public async Task DataFilterPickList([FromQuery] string ListKey) + [HttpGet("PickList", Name = nameof(DataListTemplatePickList))] + public async Task DataListTemplatePickList([FromQuery] string ListKey) { if (serverState.IsClosed) return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); @@ -103,7 +103,7 @@ namespace AyaNova.Api.Controllers /// - /// Put (update) DataFilter + /// Put (update) DataListTemplate /// /// Required roles: /// Any (public filter) or owned only (private filter) @@ -113,7 +113,7 @@ namespace AyaNova.Api.Controllers /// /// [HttpPut("{id}")] - public async Task PutDataFilter([FromRoute] long id, [FromBody] DataListTemplate inObj) + public async Task PutDataListTemplate([FromRoute] long id, [FromBody] DataListTemplate inObj) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); @@ -148,7 +148,7 @@ namespace AyaNova.Api.Controllers /// - /// Post DataFilter + /// Post DataListTemplate /// /// Required roles: /// BizAdminFull, InventoryFull, TechFull @@ -157,7 +157,7 @@ namespace AyaNova.Api.Controllers /// Automatically filled from route path, no need to specify in body /// [HttpPost] - public async Task PostDataFilter([FromBody] DataListTemplate inObj, ApiVersion apiVersion) + public async Task PostDataListTemplate([FromBody] DataListTemplate inObj, ApiVersion apiVersion) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); @@ -177,14 +177,14 @@ namespace AyaNova.Api.Controllers if (o == null) return BadRequest(new ApiErrorResponse(biz.Errors)); 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)); } /// - /// Delete DataFilter + /// Delete DataListTemplate /// /// Required roles: /// Any if public otherwise creator only @@ -193,7 +193,7 @@ namespace AyaNova.Api.Controllers /// /// Ok [HttpDelete("{id}")] - public async Task DeleteDataFilter([FromRoute] long id) + public async Task DeleteDataListTemplate([FromRoute] long id) { if (!serverState.IsOpen) return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason)); diff --git a/server/AyaNova/biz/AyaType.cs b/server/AyaNova/biz/AyaType.cs index 486f5768..d43a8230 100644 --- a/server/AyaNova/biz/AyaType.cs +++ b/server/AyaNova/biz/AyaType.cs @@ -32,8 +32,9 @@ namespace AyaNova.Biz DEPRECATED_REUSELATER_15 = 15, DEPRECATED_REUSELATER_16 = 16, FileAttachment = 17, - DataFilter = 18, - FormCustom = 19 + DataListFilter = 18, + FormCustom = 19, + DataListTemplate = 20 //NOTE: New objects added here need to also be added to the following classes: diff --git a/server/AyaNova/biz/BizObjectExistsInDatabase.cs b/server/AyaNova/biz/BizObjectExistsInDatabase.cs index 78851b87..cfc7db94 100644 --- a/server/AyaNova/biz/BizObjectExistsInDatabase.cs +++ b/server/AyaNova/biz/BizObjectExistsInDatabase.cs @@ -1,67 +1,70 @@ -using System.Linq; -using System.Threading.Tasks; -using Microsoft.EntityFrameworkCore; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.JsonPatch; -using EnumsNET; -using AyaNova.Util; -using AyaNova.Api.ControllerHelpers; -using AyaNova.Biz; -using AyaNova.Models; +// using System.Linq; +// using System.Threading.Tasks; +// using Microsoft.EntityFrameworkCore; +// using Microsoft.AspNetCore.Mvc; +// using Microsoft.AspNetCore.JsonPatch; +// using EnumsNET; +// using AyaNova.Util; +// using AyaNova.Api.ControllerHelpers; +// using AyaNova.Biz; +// using AyaNova.Models; -namespace AyaNova.Biz -{ +// namespace AyaNova.Biz +// { - //TODO: UNTESTED, UNUSED (SO FAR)CODE - //This was just blocked out because I know I will need it in future - internal static class BizObjectExistsInDatabase - { +// //TODO: UNTESTED, UNUSED (SO FAR)CODE +// //This was just blocked out because I know I will need it in future +//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) - { - return Exists(tid.ObjectType, tid.ObjectId); - } +// internal static bool Exists(AyaTypeId tid) +// { +// return Exists(tid.ObjectType, tid.ObjectId); +// } - //Returns existance status of object type and id specified in database - internal static bool Exists(AyaType aytype, long id, AyContext ct = null) - { - //new up a context?? - if (ct == null) - { - ct = ServiceProviderProvider.DBContext; - } - switch (aytype) - { - case AyaType.User: - return ct.User.Any(m => m.Id == id); - case AyaType.Widget: - return ct.Widget.Any(m => m.Id == id); - case AyaType.FileAttachment: - return ct.FileAttachment.Any(m => m.Id == id); - case AyaType.DataFilter: - return ct.DataListFilter.Any(m => m.Id == id); - case AyaType.FormCustom: - return ct.FormCustom.Any(m => m.Id == id); +// //Returns existance status of object type and id specified in database +// internal static bool Exists(AyaType aytype, long id, AyContext ct = null) +// { +// //new up a context?? +// if (ct == null) +// { +// ct = ServiceProviderProvider.DBContext; +// } +// switch (aytype) +// { +// case AyaType.User: +// return ct.User.Any(m => m.Id == id); +// case AyaType.Widget: +// return ct.Widget.Any(m => m.Id == id); +// case AyaType.FileAttachment: +// return ct.FileAttachment.Any(m => m.Id == id); +// case AyaType.DataListFilter: +// return ct.DataListFilter.Any(m => m.Id == id); +// case AyaType.DataListTemplate: +// return ct.DataListTemplate.Any(m => m.Id == id); +// case AyaType.FormCustom: +// return ct.FormCustom.Any(m => m.Id == id); - default: - throw new System.NotSupportedException($"AyaNova.BLL.BizObjectExistsInDatabase::Exists type {aytype.ToString()} is not supported"); - } +// default: +// throw new System.NotSupportedException($"AyaNova.BLL.BizObjectExistsInDatabase::Exists type {aytype.ToString()} is not supported"); +// } - } +// } - ///////////////////////////////////////////////////////////////////// +// ///////////////////////////////////////////////////////////////////// - }//eoc +// }//eoc -}//eons +// }//eons diff --git a/server/AyaNova/biz/BizObjectFactory.cs b/server/AyaNova/biz/BizObjectFactory.cs index d7f65b71..8f7e5947 100644 --- a/server/AyaNova/biz/BizObjectFactory.cs +++ b/server/AyaNova/biz/BizObjectFactory.cs @@ -35,8 +35,10 @@ namespace AyaNova.Biz return new TrialBiz(dbcontext, userId, roles); case AyaType.Locale: 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); + case AyaType.DataListTemplate: + return new DataListTemplateBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles); case AyaType.FormCustom: return new FormCustomBiz(dbcontext, userId, ServerBootConfig.AYANOVA_DEFAULT_LANGUAGE_ID, roles); diff --git a/server/AyaNova/biz/BizObjectNameFetcherDirect.cs b/server/AyaNova/biz/BizObjectNameFetcherDirect.cs index 245861c2..d1979336 100644 --- a/server/AyaNova/biz/BizObjectNameFetcherDirect.cs +++ b/server/AyaNova/biz/BizObjectNameFetcherDirect.cs @@ -30,13 +30,17 @@ namespace AyaNova.Biz TABLE = "afileattachment"; COLUMN = "displayfilename"; break; - case AyaType.DataFilter: - TABLE = "adatafilter"; + case AyaType.DataListFilter: + TABLE = "adatalistfilter"; break; case AyaType.FormCustom: TABLE = "aformcustom"; COLUMN = "formkey"; break; + case AyaType.DataListTemplate: + TABLE = "adatalisttemplate"; + COLUMN = "datalistkey"; + break; default: throw new System.NotSupportedException($"AyaNova.BLL.BizObjectNameFetcher::Name type {aytype.ToString()} is not supported"); } diff --git a/server/AyaNova/biz/BizRoles.cs b/server/AyaNova/biz/BizRoles.cs index 9ee2836a..37ae7792 100644 --- a/server/AyaNova/biz/BizRoles.cs +++ b/server/AyaNova/biz/BizRoles.cs @@ -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, ReadFullRecord = AuthorizationRoles.All diff --git a/server/AyaNova/biz/DataListFilterBiz.cs b/server/AyaNova/biz/DataListFilterBiz.cs index 83023416..3be8938e 100644 --- a/server/AyaNova/biz/DataListFilterBiz.cs +++ b/server/AyaNova/biz/DataListFilterBiz.cs @@ -22,7 +22,7 @@ namespace AyaNova.Biz UserId = currentUserId; UserLocaleId = userLocaleId; CurrentUserRoles = UserRoles; - BizType = AyaType.DataFilter; + BizType = AyaType.DataListFilter; } internal static DataListFilterBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext) diff --git a/server/AyaNova/biz/DataListTemplateBiz.cs b/server/AyaNova/biz/DataListTemplateBiz.cs index 09a038c3..05753037 100644 --- a/server/AyaNova/biz/DataListTemplateBiz.cs +++ b/server/AyaNova/biz/DataListTemplateBiz.cs @@ -22,7 +22,7 @@ namespace AyaNova.Biz UserId = currentUserId; UserLocaleId = userLocaleId; CurrentUserRoles = UserRoles; - BizType = AyaType.DataFilter; + BizType = AyaType.DataListFilter; } internal static DataListTemplateBiz GetBiz(AyContext ct, Microsoft.AspNetCore.Http.HttpContext httpContext)