This commit is contained in:
2020-01-23 22:56:01 +00:00
parent 866428776f
commit 784ea46fd1
24 changed files with 365 additions and 902 deletions

View File

@@ -13,8 +13,8 @@ namespace AyaNova.Api.Controllers
/// </summary>
[ApiVersion("8.0")]
[Route("api/v{version:apiVersion}/")]
[AllowAnonymous]
[ApiController]
[AllowAnonymous]
[ApiController]
public class ApiMetaController : ControllerBase
{
private readonly ApiServerState serverState;
@@ -89,351 +89,348 @@ namespace AyaNova.Api.Controllers
}
#region sigtest script
/*
/*
<div style=""text-align: center;"">
<hr/>
<h2>SIGTEST - 1</h2>
<h4>This is the signature header</h4>
<canvas id=""sigpad"" width=""600"" height=""200"" style=""border: 1px dotted;touch-action: none;"">
<p>
Your browser does not support signing <br/>
The following browsers are supported:<br/>
IE 9.0 +, FIREFOX 3.0 +, SAFARI 3.0 +, CHROME 3.0 +, OPERA 10.0 +, IPAD 1.0 +, IPHONE
1.0 +, ANDROID 1.0 +</p>
</canvas>
</div>
{SigScript()}
<div style=""text-align: center;"">
<hr/>
<h2>SIGTEST - 1</h2>
<h4>This is the signature header</h4>
<canvas id=""sigpad"" width=""600"" height=""200"" style=""border: 1px dotted;touch-action: none;"">
<p>
Your browser does not support signing <br/>
The following browsers are supported:<br/>
IE 9.0 +, FIREFOX 3.0 +, SAFARI 3.0 +, CHROME 3.0 +, OPERA 10.0 +, IPAD 1.0 +, IPHONE
1.0 +, ANDROID 1.0 +</p>
</canvas>
</div>
{SigScript()}
private string SigScript(){
return @"<script type=""text/javascript"">
$(document).ready(function () {
var canvas = document.getElementById(""sigpad"");
private string SigScript(){
return @"<script type=""text/javascript"">
$(document).ready(function () {
var canvas = document.getElementById(""sigpad"");
///////////////////////////////////////////////
// Prevent scrolling when touching the canvas
//addEventListener('touchstart', FUNCTION, {passive: false});
document.body.addEventListener(""touchstart"", function (e) {
if (e.target == canvas) {
e.preventDefault();
}
}, {passive: false});
document.body.addEventListener(""touchend"", function (e) {
if (e.target == canvas) {
e.preventDefault();
}
}, {passive: false});
document.body.addEventListener(""touchmove"", function (e) {
if (e.target == canvas) {
e.preventDefault();
}
}, {passive: false});
///////////////////////////////////////////////
// Prevent scrolling when touching the canvas
//addEventListener('touchstart', FUNCTION, {passive: false});
document.body.addEventListener(""touchstart"", function (e) {
if (e.target == canvas) {
e.preventDefault();
}
}, {passive: false});
document.body.addEventListener(""touchend"", function (e) {
if (e.target == canvas) {
e.preventDefault();
}
}, {passive: false});
document.body.addEventListener(""touchmove"", function (e) {
if (e.target == canvas) {
e.preventDefault();
}
}, {passive: false});
///////////////////////////////////////////////
$('#sigpad').sigpad();
});
(function ($) {
$.fn.extend(
{
sigpad: function (options) {
// Default options
var defaults = {
lineWidth: 3.0,
lineCap: 'round',
lineJoin: 'round',
miterLimit: 10,
strokeStyle: 'black',
fillStyle: 'none',
showClear: false,
clearLabel: 'Clear',
clearStyle: 'button'
};
options = $.extend(defaults, options);
return this.each(function () {
if (this.nodeName === 'CANVAS') {
$(this).css('cursor', 'pointer');
//$(this).attr('onclick', 'function onclick(event) { void 1; }');
$(this).click('function onclick(event) { void 1; }');
if (this.getContext) {
var canvas = this;
var context = this.getContext('2d');
var id = $(this).attr('id');
$(this).after('<div id=""' + id + '-controls"" style=""width:' + $(this).width() + 'px""></div>');
context.underInteractionEnabled = true;
// Overrides with passed options
context.lineWidth = options.lineWidth;
context.lineCap = options.lineCap;
context.lineJoin = options.lineJoin;
context.miterLimit = options.miterLimit;
context.strokeStyle = options.strokeStyle;
context.fillStyle = options.fillStyle;
var data_input = id + '-data';
$(this).after('<input type=""hidden"" id=""' + data_input + '"" name=""' + data_input + '"" />');
//case 1975
//add hidden to form dirty tracking
$('form').trigger('rescan.areYouSure');
// Defines all our tracking variables
var drawing = false;
var height = $('#' + id).height();
var width = $('#' + id).width();
var svg_path = '';
var scrollLeft = 0;
var scrollTop = 0;
// var offsetX = $(this).attr('offsetLeft');
// var offsetY = $(this).attr('offsetTop');
var offsetX = 0;
var offsetY = 0;
var inside = false;
var prevX = false;
var prevY = false;
var x = false;
var y = false;
// Mouse events
$(document).mousedown(function (e) { drawingStart(e); });
$(document).mousemove(function (e) { drawingMove(e); });
$(document).mouseup(function () { drawingStop(); });
// Touch events
$(document).bind('touchstart', function (e) { drawingStart(e); });
$(document).bind('touchmove', function (e) { drawingMove(e); });
$(document).bind('touchend', function () { drawingStop(); });
$(document).bind('touchcancel', function () { drawingStop(); });
// Adds the clear button / link
if (options.showClear === true) {
// var clear_tag = (options.clearStyle == 'link' ? 'div' : 'button');
// $('#' + id + '-controls').append('<' + clear_tag + ' id=""' + id + '-clear"" style=""float:left"">' + options.clearLabel + '</' + clear_tag + '><br style=""clear:both"" />');
$('#' + id + '-controls').append('<div ' + ' id=""' + id + '-clear"" >' +
'<span class=""btn btn-sm btn-danger icon-Delete ay-icon-large""></span></div>');
clear = true;
}
// Clearing the canvas
$('#' + id + '-clear').click(function (e) {
context.save();
context.beginPath();
context.closePath();
context.restore();
context.clearRect(0, 0, $(canvas).width(), $(canvas).height());
$('#' + data_input).val('');
});
function getTouch(e) {
//console.log(e);//3566
// iPhone/iPad/iPod uses event.touches and not the passed event
if (typeof (event) != ""undefined"" && typeof (event.touches) != ""undefined"") {
e = event.touches.item(0);
scrollLeft = document.body.scrollLeft;
scrollTop = document.body.scrollTop;
}
else {
scrollLeft = $(document).scrollLeft();
scrollTop = $(document).scrollTop();
}
//console.log(""scrollLeft:"" + scrollLeft.toString());
//console.log(""scrollTop:"" + scrollTop.toString());
// Tracks last position to handle dots (as opposed to lines)
if (x != false) {
prevX = x;
prevY = y;
}
// Calculates the X and Y values
x = e.clientX - (offsetX - scrollLeft);
y = e.clientY - (offsetY - scrollTop);
return e;
}
function draw(type) {
if (type != 'stop') {
if (type == 'start') {
inside = false;
prevX = false;
prevY = false;
context.beginPath();
context.moveTo(x, y);
if (svg_path == '') {
//timestamp and dimentions
var currentDate = new Date();
var captured = currentDate.getFullYear() + ':' + (currentDate.getMonth() + 1) + ':' + currentDate.getDate() + ':' + currentDate.getHours() + ':' + currentDate.getMinutes() + ':' + currentDate.getSeconds();
svg_path = '{version=1 width=' + width + ' height=' + height + ' captured=' + captured + '}';
}
if (svg_path != '') {
svg_path += 'X';
}
//svg_path = '{polyline points=""';
}
else {
// If there's no previous increment since it's a .
if (prevX == false) {
x = x + 1;
y = y + 1;
}
context.lineTo(x, y);
}
context.stroke();
if (svg_path.length > 0 && svg_path.substring(svg_path.length - 1) != '""') {
svg_path = svg_path + ' ';
}
svg_path = svg_path + x + ',' + y;
if ((x > 0 && x <= width) && (y > 0 && y <= height)) {
inside = true;
//console.log(""INSIDE"");
} else {
//console.log(""OUTSIDE X="" + x.toString() + "", Y="" + y.toString() + "", WIDTH="" + width.toString() + "", HEIGHT="" + height.toString());
}
}
else {
draw('move');
if (inside == true) {
// Closes the polyline (with style info) and adds the closing svg tag
//svg_path = svg_path + '"" style=""fill:' + options.fillStyle + ';stroke:' + context.strokeStyle + ';stroke-width:' + context.lineWidth + '"" /}{/svg}';
var element = $('#' + data_input);
var svg_data = element.val();
// Adds the opening and closing SVG tags
// if (svg_data == '')
// {
// svg_data = '{?xml version=""1.0"" standalone=""no""?}{!DOCTYPE svg PUBLIC ""-//W3C//DTD SVG 1.1//EN"" ""http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd""}{svg width=""' + width + '"" height=""' + height + '"" version=""1.1"" xmlns=""http://www.w3.org/2000/svg""}{/svg}';
// }
// Appends the recorded path
//element.val(svg_data.substring(0, svg_data.length - 6) + svg_path);
element.val(svg_path);
//rescan hidden field form changed
//case 1975
$('form').trigger('checkform.areYouSure');
}
}
}
function drawingStart(e) {
// console.log(""drawing start"");//3566
setCanvasOffset();
// Prevent the default action (scrolling) from occurring
if (inside == true) {
e.preventDefault();
}
drawing = true;
e = getTouch(e);
context.strokeStyle = $('#' + id + '-colors div.selected').css('backgroundColor');
draw('start');
}
function drawingMove(e) {
//console.log(""drawing move"");
// Prevent the default action (scrolling) from occurring
if (inside == true) {
e.preventDefault();
}
if (drawing == true) {
e = getTouch(e);
draw('move');
}
return false;
}
function drawingStop() {
//console.log(""drawing STOP"");
drawing = false;
// Draws one last line so we can draw dots (e.g. i)
draw('stop');
}
//===========================
function setCanvasOffset() {
canvasOffset = Offset(document.getElementById(id));
offsetX = canvasOffset.left;
offsetY = canvasOffset.top;
}
function Offset(element) {
if (element === undefined) return null;
var obj = element.getBoundingClientRect();
return {
left: obj.left + window.pageXOffset,
top: obj.top + window.pageYOffset
};
}
//===============
}
// else {
// alert('Your browser does not support the CANVAS element required for signing. The following browsers will work: IE 9.0+, FIREFOX 3.0+, SAFARI 3.0+, CHROME 3.0+, OPERA 10.0+, IPAD 1.0+, IPHONE 1.0+, ANDROID 1.0+');
// }
}
else {
alert('Not a CANVAS element');
}
});
}
});
})(jQuery);
</script>";
}
*/
$('#sigpad').sigpad();
});
(function ($) {
$.fn.extend(
{
sigpad: function (options) {
// Default options
var defaults = {
lineWidth: 3.0,
lineCap: 'round',
lineJoin: 'round',
miterLimit: 10,
strokeStyle: 'black',
fillStyle: 'none',
showClear: false,
clearLabel: 'Clear',
clearStyle: 'button'
};
options = $.extend(defaults, options);
return this.each(function () {
if (this.nodeName === 'CANVAS') {
$(this).css('cursor', 'pointer');
//$(this).attr('onclick', 'function onclick(event) { void 1; }');
$(this).click('function onclick(event) { void 1; }');
if (this.getContext) {
var canvas = this;
var context = this.getContext('2d');
var id = $(this).attr('id');
$(this).after('<div id=""' + id + '-controls"" style=""width:' + $(this).width() + 'px""></div>');
context.underInteractionEnabled = true;
// Overrides with passed options
context.lineWidth = options.lineWidth;
context.lineCap = options.lineCap;
context.lineJoin = options.lineJoin;
context.miterLimit = options.miterLimit;
context.strokeStyle = options.strokeStyle;
context.fillStyle = options.fillStyle;
var data_input = id + '-data';
$(this).after('<input type=""hidden"" id=""' + data_input + '"" name=""' + data_input + '"" />');
//case 1975
//add hidden to form dirty tracking
$('form').trigger('rescan.areYouSure');
// Defines all our tracking variables
var drawing = false;
var height = $('#' + id).height();
var width = $('#' + id).width();
var svg_path = '';
var scrollLeft = 0;
var scrollTop = 0;
// var offsetX = $(this).attr('offsetLeft');
// var offsetY = $(this).attr('offsetTop');
var offsetX = 0;
var offsetY = 0;
var inside = false;
var prevX = false;
var prevY = false;
var x = false;
var y = false;
// Mouse events
$(document).mousedown(function (e) { drawingStart(e); });
$(document).mousemove(function (e) { drawingMove(e); });
$(document).mouseup(function () { drawingStop(); });
// Touch events
$(document).bind('touchstart', function (e) { drawingStart(e); });
$(document).bind('touchmove', function (e) { drawingMove(e); });
$(document).bind('touchend', function () { drawingStop(); });
$(document).bind('touchcancel', function () { drawingStop(); });
// Adds the clear button / link
if (options.showClear === true) {
// var clear_tag = (options.clearStyle == 'link' ? 'div' : 'button');
// $('#' + id + '-controls').append('<' + clear_tag + ' id=""' + id + '-clear"" style=""float:left"">' + options.clearLabel + '</' + clear_tag + '><br style=""clear:both"" />');
$('#' + id + '-controls').append('<div ' + ' id=""' + id + '-clear"" >' +
'<span class=""btn btn-sm btn-danger icon-Delete ay-icon-large""></span></div>');
clear = true;
}
// Clearing the canvas
$('#' + id + '-clear').click(function (e) {
context.save();
context.beginPath();
context.closePath();
context.restore();
context.clearRect(0, 0, $(canvas).width(), $(canvas).height());
$('#' + data_input).val('');
});
function getTouch(e) {
//console.log(e);//3566
// iPhone/iPad/iPod uses event.touches and not the passed event
if (typeof (event) != ""undefined"" && typeof (event.touches) != ""undefined"") {
e = event.touches.item(0);
scrollLeft = document.body.scrollLeft;
scrollTop = document.body.scrollTop;
}
else {
scrollLeft = $(document).scrollLeft();
scrollTop = $(document).scrollTop();
}
//console.log(""scrollLeft:"" + scrollLeft.toString());
//console.log(""scrollTop:"" + scrollTop.toString());
// Tracks last position to handle dots (as opposed to lines)
if (x != false) {
prevX = x;
prevY = y;
}
// Calculates the X and Y values
x = e.clientX - (offsetX - scrollLeft);
y = e.clientY - (offsetY - scrollTop);
return e;
}
function draw(type) {
if (type != 'stop') {
if (type == 'start') {
inside = false;
prevX = false;
prevY = false;
context.beginPath();
context.moveTo(x, y);
if (svg_path == '') {
//timestamp and dimentions
var currentDate = new Date();
var captured = currentDate.getFullYear() + ':' + (currentDate.getMonth() + 1) + ':' + currentDate.getDate() + ':' + currentDate.getHours() + ':' + currentDate.getMinutes() + ':' + currentDate.getSeconds();
svg_path = '{version=1 width=' + width + ' height=' + height + ' captured=' + captured + '}';
}
if (svg_path != '') {
svg_path += 'X';
}
//svg_path = '{polyline points=""';
}
else {
// If there's no previous increment since it's a .
if (prevX == false) {
x = x + 1;
y = y + 1;
}
context.lineTo(x, y);
}
context.stroke();
if (svg_path.length > 0 && svg_path.substring(svg_path.length - 1) != '""') {
svg_path = svg_path + ' ';
}
svg_path = svg_path + x + ',' + y;
if ((x > 0 && x <= width) && (y > 0 && y <= height)) {
inside = true;
//console.log(""INSIDE"");
} else {
//console.log(""OUTSIDE X="" + x.toString() + "", Y="" + y.toString() + "", WIDTH="" + width.toString() + "", HEIGHT="" + height.toString());
}
}
else {
draw('move');
if (inside == true) {
// Closes the polyline (with style info) and adds the closing svg tag
//svg_path = svg_path + '"" style=""fill:' + options.fillStyle + ';stroke:' + context.strokeStyle + ';stroke-width:' + context.lineWidth + '"" /}{/svg}';
var element = $('#' + data_input);
var svg_data = element.val();
// Adds the opening and closing SVG tags
// if (svg_data == '')
// {
// svg_data = '{?xml version=""1.0"" standalone=""no""?}{!DOCTYPE svg PUBLIC ""-//W3C//DTD SVG 1.1//EN"" ""http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd""}{svg width=""' + width + '"" height=""' + height + '"" version=""1.1"" xmlns=""http://www.w3.org/2000/svg""}{/svg}';
// }
// Appends the recorded path
//element.val(svg_data.substring(0, svg_data.length - 6) + svg_path);
element.val(svg_path);
//rescan hidden field form changed
//case 1975
$('form').trigger('checkform.areYouSure');
}
}
}
function drawingStart(e) {
// console.log(""drawing start"");//3566
setCanvasOffset();
// Prevent the default action (scrolling) from occurring
if (inside == true) {
e.preventDefault();
}
drawing = true;
e = getTouch(e);
context.strokeStyle = $('#' + id + '-colors div.selected').css('backgroundColor');
draw('start');
}
function drawingMove(e) {
//console.log(""drawing move"");
// Prevent the default action (scrolling) from occurring
if (inside == true) {
e.preventDefault();
}
if (drawing == true) {
e = getTouch(e);
draw('move');
}
return false;
}
function drawingStop() {
//console.log(""drawing STOP"");
drawing = false;
// Draws one last line so we can draw dots (e.g. i)
draw('stop');
}
//===========================
function setCanvasOffset() {
canvasOffset = Offset(document.getElementById(id));
offsetX = canvasOffset.left;
offsetY = canvasOffset.top;
}
function Offset(element) {
if (element === undefined) return null;
var obj = element.getBoundingClientRect();
return {
left: obj.left + window.pageXOffset,
top: obj.top + window.pageYOffset
};
}
//===============
}
// else {
// alert('Your browser does not support the CANVAS element required for signing. The following browsers will work: IE 9.0+, FIREFOX 3.0+, SAFARI 3.0+, CHROME 3.0+, OPERA 10.0+, IPAD 1.0+, IPHONE 1.0+, ANDROID 1.0+');
// }
}
else {
alert('Not a CANVAS element');
}
});
}
});
})(jQuery);
</script>";
}
*/
#endregion
/// <summary>
/// Get API server info for general display
///
/// Required roles: Any
///
/// Get API server info for general display
/// </summary>
/// <returns>API server info</returns>
[HttpGet("ServerInfo")]
@@ -455,9 +452,6 @@ document.body.addEventListener(""touchmove"", function (e) {
#if (DEBUG)
/// <summary>
/// Get build mode of server, used for automated testing purposes
///
/// Required roles: Any
///
/// </summary>
/// <returns>"DEBUG" or "RELEASE"</returns>
[HttpGet("BuildMode")]
@@ -466,11 +460,8 @@ document.body.addEventListener(""touchmove"", function (e) {
return Ok(new { data = new { BuildMode = "DEBUG" } });
}
#else
/// <summary>
/// <summary>
/// Get build mode of server, used for automated testing purposes
///
/// Required roles: Any
///
/// </summary>
/// <returns>"DEBUG" or "RELEASE"</returns>
[HttpGet("BuildMode")]

View File

@@ -115,7 +115,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Upload attachment file
///
/// Required roles: Same roles as object that file is being attached to
/// Requires same Authorization roles as object that file is being attached to
///
/// </summary>
/// <returns>NameValue list of filenames and attachment id's</returns>

View File

@@ -43,8 +43,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get name value localized display value list of AyaNova enumerated types for list specified
///
/// Required roles: Any
/// </summary>
/// <param name="enumkey">The key name of the enumerated type</param>
/// <returns>List</returns>
@@ -157,8 +155,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get all possible enumerated values picklist key names
///
/// Required roles: Any
/// </summary>
/// <returns>List of AyaNova enumerated type list key names that can be fetched from the AyaEnumPickList/GetPickListRoute</returns>
[HttpGet("listkeys")]

View File

@@ -43,8 +43,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get name value list of AyaNova business object types
///
/// Required roles: Any
/// </summary>
/// <returns>List</returns>
[HttpGet]

View File

@@ -43,7 +43,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get list of data for selection / viewing
///
/// Required roles: Varies by list, if not allowed will return 403 - Not Authorized
/// Authorization varies list by list, will return 403 - Not Authorized if user has insufficient role
///
/// </summary>
/// <param name="listOptions">List key, Paging, filtering and sorting options</param>
@@ -78,8 +78,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// List of all DataList keys available
///
/// Required roles: Any
/// </summary>
/// <returns>List of strings</returns>
[HttpGet("ListKeys")]
@@ -96,8 +94,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// List of all fields for data list key specified
///
/// Required roles: Any
/// </summary>
/// <returns>List of DataListFieldDefinition</returns>
[HttpGet("ListFields")]

View File

@@ -47,9 +47,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get full DataFilter object
///
/// Required roles:
/// Any (for public filter), owned only for private filter
/// </summary>
/// <param name="id"></param>
/// <returns>A single DataFilter</returns>
@@ -79,9 +76,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get DataFilter pick list
///
/// Required roles: Any
///
/// </summary>
/// <returns>List of public or owned data filters for listKey provided</returns>
[HttpGet("PickList", Name = nameof(DataFilterPickList))]
@@ -104,10 +98,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Put (update) DataFilter
///
/// Required roles:
/// Any (public filter) or owned only (private filter)
///
/// </summary>
/// <param name="id"></param>
/// <param name="inObj"></param>
@@ -149,9 +139,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Post DataFilter
///
/// Required roles:
/// BizAdminFull, InventoryFull, TechFull
/// </summary>
/// <param name="inObj"></param>
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
@@ -185,10 +172,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Delete DataFilter
///
/// Required roles:
/// Any if public otherwise creator only
///
/// </summary>
/// <param name="id"></param>
/// <returns>Ok</returns>

View File

@@ -43,9 +43,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get full DataListTemplate object
///
/// Required roles:
/// Any
/// </summary>
/// <param name="DataListKey"></param>
/// <returns>A single DataListTemplate</returns>
@@ -79,8 +76,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// List of all DataList keys available
///
/// Required roles: Any
/// </summary>
/// <returns>List of strings</returns>
[HttpGet("ListKeys")]
@@ -97,10 +92,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Put (update) DataListTemplate
///
/// Required roles:
/// BizAdminFull
///
/// </summary>
/// <param name="DataListKey"></param>
/// <param name="inObj"></param>
@@ -150,9 +141,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Delete DataListTemplate
/// (Reset DataListTemplate to default)
/// Required roles:
/// BizAdminFull
///
/// </summary>
/// <param name="DataListKey"></param>
/// <returns>Ok</returns>

View File

@@ -49,8 +49,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get event log for object and date range specified
///
/// Required roles:
/// Read rights to object type specified
/// Required Role: Read full object properties rights to object type specified
///
/// </summary>
/// <returns>Event log entry list for object</returns>
@@ -76,8 +75,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get event log entries for a specified user and date range
///
/// Required roles:
/// Read rights to User object or UserId specified must be requestor Id
/// Required Role: Read rights to User object or User's own data
///
/// </summary>
/// <returns>Event log for user</returns>

View File

@@ -49,11 +49,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get form customizations for Client form display
/// Returns 304 not modified if concurrency token provided and unchanged
///
/// Required roles:
/// Any
///
/// </summary>
/// <param name="formkey">The official form key used by AyaNova</param>
/// <param name="concurrencyToken">A prior concurrency token used to check if there are any changes without using up bandwidth sending unnecessary data</param>
@@ -95,7 +90,7 @@ namespace AyaNova.Api.Controllers
@@ -104,10 +99,6 @@ namespace AyaNova.Api.Controllers
/// Used to build UI for customizing a form
/// These values are a subset of the AyaDataTypes values
/// which can be fetched from the EnumPickList route
///
/// Required roles:
/// BizAdminFull only has rights to customize forms
///
/// </summary>
/// <returns>A list of valid values for custom field types</returns>
[HttpGet("AvailableCustomTypes")]
@@ -128,10 +119,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get a list of all customizable form keys
/// Used to build UI for customizing a form
///
/// Required roles:
/// BizAdminFull only has rights to customize forms
///
/// </summary>
/// <returns>A list of string formKey values valid for customization</returns>
[HttpGet("AvailableCustomizableFormKeys")]
@@ -153,9 +140,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Put (update) FormCustom
///
/// Required roles: BizAdminFull
///
/// </summary>
/// <param name="formkey"></param>
/// <param name="inObj"></param>
@@ -195,38 +179,6 @@ namespace AyaNova.Api.Controllers
}
// /// <summary>
// /// Post FormCustom
// ///
// /// Required roles: BizAdminFull
// /// </summary>
// /// <param name="inObj"></param>
// /// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
// /// <returns></returns>
// [HttpPost]
// public async Task<IActionResult> PostFormCustom([FromBody] FormCustom inObj, ApiVersion apiVersion)
// {
// if (!serverState.IsOpen)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// //Instantiate the business object handler
// FormCustomBiz biz = FormCustomBiz.GetBiz(ct, HttpContext);
// //check rights
// if (!Authorized.HasCreateRole(HttpContext.Items, biz.BizType))
// return StatusCode(403, new ApiNotAuthorizedResponse());
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// //Create and validate
// FormCustom o = await biz.CreateAsync(inObj);
// if (o == null)
// return BadRequest(new ApiErrorResponse(biz.Errors));
// else
// return CreatedAtAction(nameof(FormCustomController.GetFormCustom), new { formkey = o.FormKey, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
// }

View File

@@ -38,11 +38,8 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get available fields for object specified
/// Used to build UI for customizing forms, lists etc
///
/// Required roles: Any
///
/// Get available fields for Form specified
/// Used at UI for customizing forms
/// </summary>
/// <param name="FormFieldDefinitionKey"></param>
/// <returns>List of form fields and their properties</returns>

View File

@@ -58,7 +58,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Upload AyaNova 7 import file
/// Required roles: OpsAdminFull
/// </summary>
/// <returns>NameValue list of filenames and id's</returns>
[HttpPost]
@@ -145,8 +144,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Delete import file
///
/// Required roles: OpsAdminFull
/// </summary>
/// <param name="filename"></param>
/// <returns>Ok</returns>
@@ -180,8 +177,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get AyaNova 7 data dump uploaded files list
///
/// Required roles: OpsAdminFull
/// </summary>
/// <returns>List of uploaded data dump files</returns>
[HttpGet]
@@ -212,14 +207,11 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// *ERASE DATABASE and start import of previously uploaded import file
/// **This will permanently erase all current data in database without further warning as the first step in the import process**
///
/// Required roles: OpsAdminFull
///
/// </summary>
/// <param name="filename"></param>
/// <returns>Ok</returns>
[HttpPost("startImport/{filename}")]
public ActionResult StartImport([FromRoute] string filename)
[HttpPost("EraseDatabaseAndStartImport/{filename}")]
public ActionResult EraseDatabaseAndStartImport([FromRoute] string filename)
{
//Open or opsOnly and user is opsadminfull
if (!serverState.IsOpenOrOpsOnly || (serverState.IsOpsOnly && !Authorized.HasAnyRole(HttpContext.Items, AuthorizationRoles.OpsAdminFull)))

View File

@@ -48,11 +48,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get Operations jobs list
///
/// Required roles: OpsAdminFull, OpsAdminLimited, BizAdminFull, BizAdminLimited
///
/// This list cannot be filtered or queried as there are typically not many jobs
///
/// </summary>
/// <returns>List of operations jobs</returns>
[HttpGet]
@@ -86,11 +81,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get Operations log for a job
///
/// Required roles: OpsAdminFull, OpsAdminLimited, BizAdminFull, BizAdminLimited
///
/// This list cannot be filtered or queried as there are typically not many jobs
///
/// </summary>
/// <param name="gid"></param>
/// <returns>A tag</returns>

View File

@@ -46,10 +46,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get License info
///
/// Required roles:
/// AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminFull |
/// AuthorizationRoles.BizAdminLimited | AuthorizationRoles.OpsAdminLimited
/// </summary>
/// <returns>Information about the currently installed license in AyaNova</returns>
[HttpGet()]
@@ -79,9 +75,6 @@ namespace AyaNova.Api.Controllers
///
/// Posting to this route causes AyaNova to attempt to refresh it's license
/// from the AyaNova license server
///
/// Required roles:
/// AuthorizationRoles.BizAdminFull | AuthorizationRoles.OpsAdminFull
/// </summary>
/// <returns>On success returns information about the currently installed license in AyaNova</returns>
[HttpPost]
@@ -140,10 +133,6 @@ namespace AyaNova.Api.Controllers
///
/// Posting to this route causes AyaNova to request a trial license key from the AyaNova license server
/// Database must be empty and unlicensed or trial license
///
/// Required roles:
/// [OpsFull, BizAdminFull]
///
/// </summary>
/// <param name="requestData"></param>
/// <returns>HTTP 204 No Content result code on success or fail code with explanation</returns>

View File

@@ -53,8 +53,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get Locale all values
///
/// Required roles: Any
/// </summary>
/// <param name="id"></param>
/// <returns>A single Locale and it's values</returns>
@@ -90,8 +88,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get Locale pick list
/// Required roles: Any
///
/// </summary>
/// <returns>Picklist in alphabetical order of all locales</returns>
[HttpGet("PickList")]
@@ -114,8 +110,6 @@ namespace AyaNova.Api.Controllers
#if (DEBUG)
/// <summary>
/// Get a coverage report of locale keys used versus unused
/// Required roles: Any
///
/// </summary>
/// <returns>Report of all unique locale keys requested since last server reboot</returns>
[HttpGet("LocaleKeyCoverage")]
@@ -138,8 +132,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get subset of locale values
/// Required roles: Any
///
/// </summary>
/// <param name="inObj">List of locale key strings</param>
/// <returns>A key value array of localized text values</returns>
@@ -163,10 +155,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Duplicates an existing locale with a new name
///
/// Required roles: OpsAdminFull | BizAdminFull
///
/// Duplicates an existing locale with a new name
/// </summary>
/// <param name="inObj">NameIdItem object containing source locale Id and new name</param>
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
@@ -192,7 +181,7 @@ namespace AyaNova.Api.Controllers
}
else
{
return CreatedAtAction(nameof(LocaleController.GetLocale), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
return CreatedAtAction(nameof(LocaleController.GetLocale), new { id = o.Id, version = apiVersion.ToString() }, new ApiCreatedResponse(o));
}
}
@@ -200,11 +189,7 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Put (UpdateLocaleItemDisplayText)
///
/// Required roles: OpsAdminFull | BizAdminFull
///
/// Update a single key with new display text
///
/// </summary>
/// <param name="inObj">NewText/Id/Concurrency token object. NewText is new display text, Id is LocaleItem Id, concurrency token is required</param>
/// <returns></returns>
@@ -271,12 +256,8 @@ namespace AyaNova.Api.Controllers
}
/// <summary>
/// Put (UpdateLocaleName)
///
/// Required roles: OpsAdminFull | BizAdminFull
///
/// Put (UpdateLocaleName)
/// Update a locale to change the name (non-stock locales only)
///
/// </summary>
/// <param name="inObj">NewText/Id/Concurrency token object. NewText is new locale name, Id is Locale Id, concurrency token is required</param>
/// <returns></returns>
@@ -339,10 +320,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Delete Locale
///
/// Required roles:
/// BizAdminFull, InventoryFull
///
/// </summary>
/// <param name="id"></param>
/// <returns>Ok</returns>
@@ -395,32 +372,6 @@ namespace AyaNova.Api.Controllers
}
// private bool LocaleExists(long id)
// {
// return ct.Locale.Any(e => e.Id == id);
// }
//------------
// public class LocaleSubsetParam
// {
// [System.ComponentModel.DataAnnotations.Required]
// public long LocaleId { get; set; }
// [System.ComponentModel.DataAnnotations.Required]
// public List<string> Keys { get; set; }
// public LocaleSubsetParam()
// {
// Keys = new List<string>();
// }
// }
#if (DEBUG)
public class LocaleCoverageInfo
{

View File

@@ -46,9 +46,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get server log
///
/// Required roles:
/// OpsAdminFull | OpsAdminLimited
/// </summary>
/// <param name="logname"></param>
/// <returns>A single log file in plain text</returns>
@@ -93,10 +90,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get list of operations logs
///
/// Required roles:
/// OpsAdminFull | OpsAdminLimited
///
/// </summary>
/// <returns></returns>
[HttpGet()]

View File

@@ -47,9 +47,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get metrics as text document
///
/// Required roles:
/// OpsAdminFull | OpsAdminLimited
/// </summary>
/// <returns>Snapshot of metrics</returns>
[HttpGet("TextSnapShot")]
@@ -77,9 +74,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get metrics as json object
///
/// Required roles:
/// OpsAdminFull | OpsAdminLimited
/// </summary>
/// <returns>Snapshot of metrics</returns>
[HttpGet("JsonSnapShot")]

View File

@@ -47,11 +47,8 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Post search parameters
/// Required roles: Any
/// MaxResults defaults to 500
/// MaxResults = 0 returns all results
/// There is no paging as this is a dynamic response
///
/// </summary>
/// <param name="searchParams"></param>
/// <returns>SearchResult list</returns>

View File

@@ -33,7 +33,7 @@ namespace AyaNova.Api.Controllers
/// <param name="dbcontext"></param>
public ServerStateController(ILogger<ServerStateController> logger, ApiServerState apiServerState, AyContext dbcontext)
{
ct = dbcontext;
ct = dbcontext;
log = logger;
serverState = apiServerState;
}
@@ -41,9 +41,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get server state
///
/// Required roles:
/// [NONE / authentication not required]
/// </summary>
/// <returns>Current server state (Closed, OpsOnly, Open)</returns>
[HttpGet]
@@ -55,13 +52,8 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Set server state
///
/// Required roles:
/// [OpsFull, BizAdminFull]
///
/// Valid parameters:
/// One of "Closed", "OpsOnly" or "Open"
///
/// </summary>
/// <param name="state">{"NewState":"Closed"}</param>
/// <returns>NoContent 204</returns>
@@ -97,7 +89,7 @@ namespace AyaNova.Api.Controllers
//Log
EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserIdFromContext.Id(HttpContext.Items), 0, AyaType.ServerState, AyaEvent.ServerStateChange, $"{state.ServerState}-{state.Reason}"), ct);
return NoContent();
}

View File

@@ -43,8 +43,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get tag picklist
///
/// Required roles: Any
/// </summary>
/// <param name="query">The query to filter the returned list by</param>
/// <returns>Filtered list (maximum 25 items are returned for any query)</returns>
@@ -63,8 +61,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get tag cloud list
///
/// Required roles: Any
/// </summary>
/// <param name="query">The query to filter the returned list by</param>
/// <returns>List</returns>
@@ -81,30 +77,5 @@ namespace AyaNova.Api.Controllers
// /// <summary>
// /// Get all possible enumerated values picklist key names
// ///
// /// Required roles: Any
// /// </summary>
// /// <returns>List of AyaNova enumerated type list key names that can be fetched from the AyaEnumPickList/GetPickListRoute</returns>
// [HttpGet("listkeys")]
// public ActionResult GetTypesList()
// {
// if (!serverState.IsOpen)
// {
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// }
// List<KeyValuePair<string, string>> ret = new List<KeyValuePair<string, string>>();
// ret.Add(new KeyValuePair<string, string>("usertypes", "AyaNova user account types"));
// ret.Add(new KeyValuePair<string, string>("authorizationroles", "AyaNova user account role types"));
// ret.Add(new KeyValuePair<string, string>("AyaType", "All AyaNova object types, use the AyaTypeController route to fetch these"));
// return Ok(ApiOkResponse.Response(ret));
// }
}//eoc
}//ens

View File

@@ -49,9 +49,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get User
///
/// Required roles:
/// BizAdminFull, BizAdminLimited
/// </summary>
/// <param name="id"></param>
/// <returns>A single User</returns>
@@ -88,78 +85,9 @@ namespace AyaNova.Api.Controllers
}
// /// <summary>
// /// Get paged list of Users
// ///
// /// Required roles:
// /// BizAdminFull, BizAdminLimited
// ///
// /// </summary>
// /// <returns>Paged collection of Users with paging data</returns>
// [HttpGet("ListUsers", Name = nameof(ListUsers))]//We MUST have a "Name" defined or we can't get the link for the pagination, non paged urls don't need a name
// public async Task<IActionResult> ListUsers([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// {
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// }
// //Instantiate the business object handler
// UserBiz biz = UserBiz.GetBiz(ct, HttpContext);
// if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
// {
// return StatusCode(403, new ApiNotAuthorizedResponse());
// }
// if (!ModelState.IsValid)
// {
// return BadRequest(new ApiErrorResponse(ModelState));
// }
// ApiPagedResponse<System.Object> pr = await biz.GetManyAsync(Url, nameof(ListUsers), pagingOptions);
// return Ok(new ApiOkWithPagingResponse<System.Object>(pr));
// }
// /// <summary>
// /// Get User pick list
// ///
// /// Required roles: Any
// ///
// /// </summary>
// /// <param name="pagingOptions">Paging, filtering and sorting options</param>
// /// <returns>Paged id/name collection with paging data</returns>
// [HttpGet("PickList", Name = nameof(UserPickList))]
// public ActionResult UserPickList([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// {
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// }
// if (!ModelState.IsValid)
// {
// return BadRequest(new ApiErrorResponse(ModelState));
// }
// //Instantiate the business object handler
// UserBiz biz = UserBiz.GetBiz(ct, HttpContext);
// ApiPagedResponse<NameIdItem> pr = biz.GetPickList(Url, nameof(UserPickList), pagingOptions);
// return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
// }
/// <summary>
/// Put (update) User
///
/// Required roles:
/// BizAdminFull
///
/// </summary>
/// <param name="id"></param>
/// <param name="inObj"></param>
@@ -220,10 +148,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Patch (update) User
///
/// Required roles:
/// BizAdminFull
///
/// </summary>
/// <param name="id"></param>
/// <param name="concurrencyToken"></param>
@@ -282,10 +206,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Post User
///
/// Required roles:
/// BizAdminFull
///
/// </summary>
/// <param name="inObj"></param>
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
@@ -337,10 +257,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Delete User
///
/// Required roles:
/// BizAdminFull
///
/// </summary>
/// <param name="id"></param>
/// <returns>Ok</returns>

View File

@@ -47,9 +47,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get full UserOptions object
///
/// Required roles:
/// BizAdminFull, BizAdminLimited or be users own record
/// </summary>
/// <param name="id">UserId</param>
/// <returns>A single UserOptions</returns>
@@ -92,10 +89,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Put (update) UserOptions
///
/// Required roles:
/// BizAdminFull or be users own record
///
/// </summary>
/// <param name="id">User id</param>
/// <param name="inObj"></param>
@@ -156,9 +149,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Patch (update) UserOptions
///
/// Required roles:
/// BizAdminFull or be users own record
/// </summary>
/// <param name="id">UserId</param>
/// <param name="concurrencyToken"></param>

View File

@@ -51,9 +51,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Get full widget object
///
/// Required roles:
/// BizAdminFull, InventoryFull, BizAdminLimited, InventoryLimited
/// </summary>
/// <param name="id"></param>
/// <returns>A single widget</returns>
@@ -84,120 +81,9 @@ namespace AyaNova.Api.Controllers
}
// /// <summary>
// /// Get list for selection / viewing
// ///
// /// Required roles: Any in-house staff (some roles might have restrictions on exact fields that are returned)
// ///
// /// </summary>
// /// <param name="pagingOptions">Paging, filtering and sorting options</param>
// /// <returns>Collection with paging data</returns>
// [HttpGet("List", Name = nameof(List))]
// public ActionResult List([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// //Instantiate the business object handler
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
// ApiPagedResponse pr = biz.GetList(Url, nameof(List), pagingOptions).Result;
// return Ok(new ApiOkWithPagingResponse(pr));
// }
// /// <summary>
// /// TEST list with relationships
// ///
// /// Required roles: Any in-house staff (some roles might have restrictions on exact fields that are returned)
// ///
// /// </summary>
// /// <param name="pagingOptions">Paging, filtering and sorting options</param>
// /// <returns>Collection with paging data</returns>
// [HttpGet("TestGetWidgetUserEmailList", Name = nameof(TestGetWidgetUserEmailList))]
// public ActionResult TestGetWidgetUserEmailList([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// //Instantiate the business object handler
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
// ApiPagedResponse pr = biz.TestGetWidgetUserEmailList(Url, nameof(TestGetWidgetUserEmailList), pagingOptions).Result;
// return Ok(new ApiOkWithPagingResponse(pr));
// // string ret= biz.GetList(Url, nameof(List), pagingOptions).Result;
// // return Ok(ret);
// }
// /// <summary>
// /// Get paged list of widgets
// ///
// /// Required roles:
// /// BizAdminFull, InventoryFull, BizAdminLimited, InventoryLimited
// /// </summary>
// /// <returns>Paged collection of widgets with paging data</returns>
// [HttpGet("ListWidgets", Name = nameof(ListWidgets))]//We MUST have a "Name" defined or we can't get the link for the pagination, non paged urls don't need a name
// public async Task<IActionResult> ListWidgets([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// //Instantiate the business object handler
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
// if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType))
// return StatusCode(403, new ApiNotAuthorizedResponse());
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// ApiPagedResponse<Widget> pr = await biz.GetManyAsync(Url, nameof(ListWidgets), pagingOptions);
// return Ok(new ApiOkWithPagingResponse<Widget>(pr));
// }
// /// <summary>
// /// Get pick list
// ///
// /// Required roles: Any
// ///
// /// </summary>
// /// <param name="pagingOptions">Paging, filtering and sorting options</param>
// /// <returns>Paged id/name collection with paging data</returns>
// [HttpGet("PickList", Name = nameof(WidgetPickList))]
// public ActionResult WidgetPickList([FromQuery] ListOptions pagingOptions)
// {
// if (serverState.IsClosed)
// return StatusCode(503, new ApiErrorResponse(ApiErrorCode.API_CLOSED, null, serverState.Reason));
// if (!ModelState.IsValid)
// return BadRequest(new ApiErrorResponse(ModelState));
// //Instantiate the business object handler
// WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
// ApiPagedResponse<NameIdItem> pr = biz.GetPickList(Url, nameof(WidgetPickList), pagingOptions);
// return Ok(new ApiOkWithPagingResponse<NameIdItem>(pr));
// }
/// <summary>
/// Put (update) widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
///
/// </summary>
/// <param name="id"></param>
/// <param name="inObj"></param>
@@ -214,7 +100,7 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
var o = await biz.GetNoLogAsync(id);
var o = await biz.GetAsync(id, false);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
@@ -240,10 +126,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Patch (update) widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
///
/// </summary>
/// <param name="id"></param>
/// <param name="concurrencyToken"></param>
@@ -263,7 +145,7 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
var o = await biz.GetNoLogAsync(id);
var o = await biz.GetAsync(id, false);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
@@ -289,9 +171,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Post widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
/// </summary>
/// <param name="inObj"></param>
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
@@ -324,9 +203,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Duplicate widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
/// </summary>
/// <param name="id">Create a duplicate of this items id</param>
/// <param name="apiVersion">Automatically filled from route path, no need to specify in body</param>
@@ -347,7 +223,7 @@ namespace AyaNova.Api.Controllers
if (!ModelState.IsValid)
return BadRequest(new ApiErrorResponse(ModelState));
var oSrc = await biz.GetNoLogAsync(id);
var oSrc = await biz.GetAsync(id, false);
if (oSrc == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
@@ -364,11 +240,6 @@ namespace AyaNova.Api.Controllers
/// <summary>
/// Delete widget
///
/// Required roles:
/// BizAdminFull, InventoryFull
///
///
/// </summary>
/// <param name="id"></param>
/// <returns>Ok</returns>
@@ -384,7 +255,7 @@ namespace AyaNova.Api.Controllers
//Instantiate the business object handler
WidgetBiz biz = WidgetBiz.GetBiz(ct, HttpContext);
var o = await biz.GetNoLogAsync(id);
var o = await biz.GetAsync(id, false);
if (o == null)
return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));

View File

@@ -43,13 +43,7 @@ namespace AyaNova.Biz
return await ct.DataListFilter.AnyAsync(e => e.Id == id);
}
////////////////////////////////////////////////////////////////////////////////////////////////
/// GET
internal async Task<DataListFilter> GetNoLogAsync(long fetchId)
{
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
return await ct.DataListFilter.SingleOrDefaultAsync(m => m.Id == fetchId);
}
////////////////////////////////////////////////////////////////////////////////////////////////
//CREATE
@@ -127,6 +121,14 @@ namespace AyaNova.Biz
return ret;
}
////////////////////////////////////////////////////////////////////////////////////////////////
/// GET
internal async Task<DataListFilter> GetNoLogAsync(long fetchId)
{
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
return await ct.DataListFilter.SingleOrDefaultAsync(m => m.Id == fetchId);
}
//get picklist (NOT PAGED)
internal async Task<List<NameIdItem>> GetPickListAsync(string listKey)

View File

@@ -47,21 +47,13 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
/// GET
///
///
///
//Get without logging
internal async Task<Widget> GetNoLogAsync(long fetchId)
{
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
return await ct.Widget.SingleOrDefaultAsync(m => m.Id == fetchId);
}
//Get one with logging
internal async Task<Widget> GetAsync(long fetchId)
internal async Task<Widget> GetAsync(long fetchId, bool log = true)
{
//This is simple so nothing more here, but often will be copying to a different output object or some other ops
var ret = await ct.Widget.SingleOrDefaultAsync(m => m.Id == fetchId);
if (ret != null)
if (log && ret != null)
{
//Log
EventLogProcessor.LogEventToDatabaseAndSaveEntireContext(new Event(UserId, fetchId, BizType, AyaEvent.Retrieved), ct);
@@ -264,53 +256,6 @@ namespace AyaNova.Biz
////////////////////////////////////////////////////////////////////////////////////////////////
// LISTS
//
//Generic list of widgets
#region GetList
// internal async Task<ApiPagedResponse> GetList(IUrlHelper Url, string routeName, ListOptions listOptions)
// {
// //TODO: Get template (MOCKED FOR NOW UNTIL PROOF OF CONCEPT)
// var MOCK_WIDGET_DISPLAY_TEMPLATE_JSON = @"
// {
// ""full"":[""widgetname"",""widgetserial"",""widgetdollaramount"",""widgetroles"",""widgetstartdate"",""widgetactive"",""username""],
// ""mini"":[""widgetname"",""widgetserial""]
// }
// ";
// return await DataListFetcher.GetResponse(nameof(WidgetDataList), ct, Url, routeName, listOptions, MOCK_WIDGET_DISPLAY_TEMPLATE_JSON, UserId);
// }
#endregion
//TEST WIDGET->USER->EMAILADDRESS multi table list
//once this is working can replicate at will
#region TestGetWidgetUserEmailList
// internal async Task<ApiPagedResponse> TestGetWidgetUserEmailList(IUrlHelper Url, string routeName, ListOptions listOptions)
// {
// //var dlist=AyaNova.DataList.DataListFactory.GetListOfAllDataListKeyNames();
// //TODO: Get template (MOCKED FOR NOW UNTIL PROOF OF CONCEPT)
// var MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON = @"
// {
// ""full"":[""widgetname"",""username"",""emailaddress"",""widgetactive""],
// ""mini"":[""widgetname"",""username"",""emailaddress""]
// }
// ";
// return await DataListFetcher.GetResponse(nameof(TestWidgetUserEmailDataList), ct, Url, routeName, listOptions, MOCK_WIDGET_USER_EMAIL_DISPLAY_TEMPLATE_JSON, UserId);
// }
#endregion
////////////////////////////////////////////////////////////////////////////////////////////////
//VALIDATION
//
@@ -324,18 +269,6 @@ namespace AyaNova.Biz
//run validation and biz rules
bool isNew = currentObj == null;
// if (isNew)
// {
// //WARNING: this is not really the "current" object, it's been modified already by caller
// // //NEW widgets must be active
// // if (inObj.Active == null || ((bool)inObj.Active) == false)
// // {
// // AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Active", "New widget must be active");
// // }
// }
//Name required
if (string.IsNullOrWhiteSpace(proposedObj.Name))
AddError(ApiErrorCode.VALIDATION_REQUIRED, "Name");
@@ -387,23 +320,6 @@ namespace AyaNova.Biz
CustomFieldsValidator.Validate(this, FormCustomization, proposedObj.CustomFields);
}
//for debug purposes
#if (DEBUG)
//TESTING
//make a fake server error for ui testing purposes
// if (proposedObj.Count == 666)
// {
// AddError(ApiErrorCode.VALIDATION_INVALID_VALUE, "Count", "Test field server error");
// }
//removed because seeding huge kept triggering this
// if (proposedObj.DollarAmount == 666.66M)
// {
// AddError(ApiErrorCode.INVALID_OPERATION, null, "This is a test of a general server error");
// }
//TESTING
#endif
return;
}