refacto API prefix + nav.back
This commit is contained in:
parent
91f613ac4d
commit
ec901e1f10
78 changed files with 770 additions and 222 deletions
|
|
@ -14,7 +14,7 @@ using Yavsc.Models.Workflow;
|
|||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/activity")]
|
||||
[Route(Constants.APIPrefix + "/activity")]
|
||||
public class ActivityApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace Yavsc.ApiControllers
|
|||
using Yavsc.ViewModels.Auth;
|
||||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Route("api/bill"), Authorize]
|
||||
[Route(Constants.APIPrefix + "/bill"), Authorize]
|
||||
public class BillingController : Controller
|
||||
{
|
||||
readonly ApplicationDbContext dbContext;
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ namespace Yavsc.Controllers
|
|||
using Yavsc.Server.Helpers;
|
||||
|
||||
[Produces("application/json")]
|
||||
[Route("api/bookquery"), Authorize("Performer")]
|
||||
[Route(Constants.APIPrefix + "/bookquery"), Authorize("Performer")]
|
||||
public class BookQueryApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ using Yavsc.Server.Helpers;
|
|||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/estimate"), Authorize]
|
||||
[Route(Constants.APIPrefix + "/estimate"), Authorize]
|
||||
public class EstimateApiController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
|
@ -27,12 +27,12 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
bool UserIsAdminOrThis(string uid)
|
||||
{
|
||||
if (User.IsInRole(YavscConstants.AdminGroupName)) return true;
|
||||
if (User.IsInRole(Constants.AdminGroupName)) return true;
|
||||
return uid == User.GetUserId();
|
||||
}
|
||||
bool UserIsAdminOrInThese(string oid, string uid)
|
||||
{
|
||||
if (User.IsInRole(YavscConstants.AdminGroupName)) return true;
|
||||
if (User.IsInRole(Constants.AdminGroupName)) return true;
|
||||
var cuid = User.GetUserId();
|
||||
return cuid == uid || cuid == oid;
|
||||
}
|
||||
|
|
@ -82,7 +82,7 @@ namespace Yavsc.Controllers
|
|||
return BadRequest();
|
||||
}
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (!User.IsInRole(YavscConstants.AdminGroupName))
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
{
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
|
|
@ -118,7 +118,7 @@ namespace Yavsc.Controllers
|
|||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (estimate.OwnerId == null) estimate.OwnerId = uid;
|
||||
|
||||
if (!User.IsInRole(YavscConstants.AdminGroupName))
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
{
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
|
|
@ -187,7 +187,7 @@ namespace Yavsc.Controllers
|
|||
return NotFound();
|
||||
}
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (!User.IsInRole(YavscConstants.AdminGroupName))
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
{
|
||||
if (uid != estimate.OwnerId)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Yavsc.Server.Helpers;
|
|||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/EstimateTemplatesApi")]
|
||||
[Route(Constants.APIPrefix + "/EstimateTemplatesApi")]
|
||||
public class EstimateTemplatesApiController : Controller
|
||||
{
|
||||
private ApplicationDbContext _context;
|
||||
|
|
@ -62,7 +62,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (estimateTemplate.OwnerId!=uid)
|
||||
if (!User.IsInRole(YavscConstants.AdminGroupName))
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return new StatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
|
||||
_context.Entry(estimateTemplate).State = EntityState.Modified;
|
||||
|
|
@ -132,7 +132,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
var uid = User.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
if (estimateTemplate.OwnerId!=uid)
|
||||
if (!User.IsInRole(YavscConstants.AdminGroupName))
|
||||
if (!User.IsInRole(Constants.AdminGroupName))
|
||||
return new StatusCodeResult(StatusCodes.Status403Forbidden);
|
||||
|
||||
_context.EstimateTemplates.Remove(estimateTemplate);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ using Yavsc.ViewModels.FrontOffice;
|
|||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
[Route("api/front")]
|
||||
[Route(Constants.APIPrefix + "/front")]
|
||||
public class FrontOfficeApiController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ using Yavsc.Models;
|
|||
|
||||
namespace Yavsc.ApiControllers
|
||||
{
|
||||
[Route("api/payment")]
|
||||
[Route(Constants.APIPrefix + "/payment")]
|
||||
public class PaymentApiController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext dbContext;
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ namespace Yavsc.Controllers
|
|||
using Yavsc.Services;
|
||||
|
||||
[Produces("application/json")]
|
||||
[Route("api/performers")]
|
||||
[Route(Constants.APIPrefix + "/performers")]
|
||||
public class PerformersApiController : Controller
|
||||
{
|
||||
ApplicationDbContext dbContext;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ using Yavsc.Server.Helpers;
|
|||
namespace Yavsc.Controllers
|
||||
{
|
||||
[Produces("application/json")]
|
||||
[Route("api/ProductApi")]
|
||||
[Route(Constants.APIPrefix + "/ProductApi")]
|
||||
public class ProductApiController : Controller
|
||||
{
|
||||
private readonly ApplicationDbContext _context;
|
||||
|
|
@ -46,7 +46,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
|
||||
// PUT: api/ProductApi/5
|
||||
[HttpPut("{id}"),Authorize(YavscConstants.FrontOfficeGroupName)]
|
||||
[HttpPut("{id}"),Authorize(Constants.FrontOfficeGroupName)]
|
||||
public IActionResult PutProduct(long id, [FromBody] Product product)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
|
|
@ -81,7 +81,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
|
||||
// POST: api/ProductApi
|
||||
[HttpPost,Authorize(YavscConstants.FrontOfficeGroupName)]
|
||||
[HttpPost,Authorize(Constants.FrontOfficeGroupName)]
|
||||
public IActionResult PostProduct([FromBody] Product product)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
|
|
@ -110,7 +110,7 @@ namespace Yavsc.Controllers
|
|||
}
|
||||
|
||||
// DELETE: api/ProductApi/5
|
||||
[HttpDelete("{id}"),Authorize(YavscConstants.FrontOfficeGroupName)]
|
||||
[HttpDelete("{id}"),Authorize(Constants.FrontOfficeGroupName)]
|
||||
public IActionResult DeleteProduct(long id)
|
||||
{
|
||||
if (!ModelState.IsValid)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue