This commit is contained in:
@@ -7,6 +7,7 @@ using Microsoft.Extensions.Logging;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
using System;
|
||||
|
||||
|
||||
namespace AyaNova.Api.Controllers
|
||||
@@ -66,10 +67,10 @@ namespace AyaNova.Api.Controllers
|
||||
/// <summary>
|
||||
/// Get Integration
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="integrationAppId"></param>
|
||||
/// <returns>Integration</returns>
|
||||
[HttpGet("{id}")]
|
||||
public async Task<IActionResult> GetIntegration([FromRoute] long id)
|
||||
[HttpGet("{integrationAppId}")]
|
||||
public async Task<IActionResult> GetIntegration([FromRoute] Guid integrationAppId)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -78,7 +79,7 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
var o = await biz.GetAsync(id, true, true);
|
||||
var o = await biz.GetAsync(integrationAppId, true, true);
|
||||
if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND));
|
||||
return Ok(ApiOkResponse.Response(o));
|
||||
}
|
||||
@@ -112,10 +113,10 @@ namespace AyaNova.Api.Controllers
|
||||
/// <summary>
|
||||
/// Delete Integration
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="integrationAppId"></param>
|
||||
/// <returns>NoContent</returns>
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteIntegration([FromRoute] long id)
|
||||
[HttpDelete("{integrationAppId}")]
|
||||
public async Task<IActionResult> DeleteIntegration([FromRoute] Guid integrationAppId)
|
||||
{
|
||||
if (!serverState.IsOpen)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
@@ -124,7 +125,7 @@ namespace AyaNova.Api.Controllers
|
||||
IntegrationBiz biz = IntegrationBiz.GetBiz(ct, HttpContext);
|
||||
if (!Authorized.HasDeleteRole(HttpContext.Items, biz.BizType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
if (!await biz.DeleteAsync(id))
|
||||
if (!await biz.DeleteAsync(integrationAppId))
|
||||
return BadRequest(new ApiErrorResponse(biz.Errors));
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user