Remove PATCH route and code
This commit is contained in:
@@ -3,12 +3,7 @@ PRIORITY - ALWAYS Lowest level stuff first
|
|||||||
|
|
||||||
---
|
---
|
||||||
todo: API REFACTORING (note: workordercontroller / biz should be following all these rules so it's the template if need reference)
|
todo: API REFACTORING (note: workordercontroller / biz should be following all these rules so it's the template if need reference)
|
||||||
todo: consider and then get rid of PATCH in all routes
|
todo: get rid of PATCH in all routes
|
||||||
unless compelling reason to keep
|
|
||||||
Would there be a place in the UI where I would want to patch part of an object?
|
|
||||||
Because I already ditched that for the workorder which is the heaviest and most patchable object in the bunch
|
|
||||||
if I change a name would I patch it or just put the whole record?
|
|
||||||
supporting it only for the use of third party users is not a good idea
|
|
||||||
todo: consider renaming ConcurrencyToken to a shorter string?
|
todo: consider renaming ConcurrencyToken to a shorter string?
|
||||||
todo: all api route parameters, post object sb "newObject", put="putObject"
|
todo: all api route parameters, post object sb "newObject", put="putObject"
|
||||||
IN BIZ TOO
|
IN BIZ TOO
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.Routing;
|
using Microsoft.AspNetCore.Routing;
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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 EnumsNET;
|
using EnumsNET;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using EnumsNET;
|
using EnumsNET;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using EnumsNET;
|
using EnumsNET;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ 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 EnumsNET;
|
using EnumsNET;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
|
|||||||
@@ -1,66 +0,0 @@
|
|||||||
using System.Linq;
|
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace AyaNova.Biz
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
internal static class ValidateJsonPatch<T> where T : class
|
|
||||||
{
|
|
||||||
|
|
||||||
internal static bool Validate(BizObject biz, JsonPatchDocument<T> objectPatch, string protectedProperties = "")
|
|
||||||
{
|
|
||||||
bool IsValid = true;
|
|
||||||
|
|
||||||
string[] ProtectedProperties = null;
|
|
||||||
if (!string.IsNullOrEmpty(protectedProperties))
|
|
||||||
{
|
|
||||||
protectedProperties = protectedProperties.Replace(", ", ",").Replace(" ,", ",").Trim();
|
|
||||||
ProtectedProperties = protectedProperties.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ProtectedProperties != null)
|
|
||||||
foreach (string Property in ProtectedProperties)
|
|
||||||
{
|
|
||||||
if (objectPatch.Operations.Any(m => m.path == $"/{Property.ToLowerInvariant()}"))
|
|
||||||
{
|
|
||||||
biz.AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, Property);
|
|
||||||
IsValid = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//check for in-valid patches
|
|
||||||
if (objectPatch.Operations.Any(m => m.path == "/id"))
|
|
||||||
{
|
|
||||||
biz.AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Id");
|
|
||||||
IsValid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (objectPatch.Operations.Any(m => m.path == "/serial"))
|
|
||||||
{
|
|
||||||
biz.AddError(ApiErrorCode.VALIDATION_NOT_CHANGEABLE, "Serial");
|
|
||||||
IsValid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objectPatch.Operations.Any(m => m.op == "add"))
|
|
||||||
{
|
|
||||||
biz.AddError(ApiErrorCode.INVALID_OPERATION, "add");
|
|
||||||
IsValid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objectPatch.Operations.Any(m => m.op == "remove"))
|
|
||||||
{
|
|
||||||
biz.AddError(ApiErrorCode.INVALID_OPERATION, "remove");
|
|
||||||
IsValid = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return IsValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}//eoc
|
|
||||||
|
|
||||||
}//eons
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using EnumsNET;
|
using EnumsNET;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
using AyaNova.Api.ControllerHelpers;
|
using AyaNova.Api.ControllerHelpers;
|
||||||
using AyaNova.Models;
|
using AyaNova.Models;
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using System.Threading.Tasks;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using Microsoft.AspNetCore.JsonPatch;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using EnumsNET;
|
using EnumsNET;
|
||||||
using AyaNova.Util;
|
using AyaNova.Util;
|
||||||
|
|||||||
Reference in New Issue
Block a user