PCRB follow up client side logic
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
using MesaFabApproval.API.Services;
|
||||
using MesaFabApproval.API.Utilities;
|
||||
using MesaFabApproval.Shared.Models;
|
||||
using MesaFabApproval.Shared.Services;
|
||||
|
||||
@ -11,13 +12,13 @@ namespace MesaFabApproval.API.Controllers;
|
||||
public class ApprovalController : ControllerBase {
|
||||
private readonly ILogger<ApprovalController> _logger;
|
||||
private readonly IApprovalService _approvalService;
|
||||
private readonly IMonInWorkerClient _monInClient;
|
||||
private readonly IMonInUtils _monInUtils;
|
||||
|
||||
public ApprovalController(ILogger<ApprovalController> logger, IApprovalService approvalService,
|
||||
IMonInWorkerClient monInClient) {
|
||||
IMonInUtils monInUtils) {
|
||||
_logger = logger ?? throw new ArgumentNullException("ILogger not injected");
|
||||
_approvalService = approvalService ?? throw new ArgumentNullException("IApprovalService not injected");
|
||||
_monInClient = monInClient ?? throw new ArgumentNullException("IMonInWorkerClient not injected");
|
||||
_monInUtils = monInUtils ?? throw new ArgumentNullException("IMonInUtils not injected");
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@ -39,26 +40,19 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when attempting to create approval: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot create new approval, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "CreateApproval";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,26 +75,19 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when getting approvals for issue {issueId}: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot get approvals, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "GetApprovalsForIssueId";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,26 +110,19 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when getting approvals for user {userId}: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot get approvals, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "GetApprovalsForUserId";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,26 +145,19 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when getting approval group members for sub role {subRoleId}: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot get approval group members, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "GetApprovalsGroupMembers";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -197,7 +170,7 @@ public class ApprovalController : ControllerBase {
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation($"Attempting to update approval");
|
||||
_logger.LogInformation("Attempting to update approval");
|
||||
|
||||
if (approval is null) throw new ArgumentNullException($"approval cannot be null");
|
||||
|
||||
@ -207,26 +180,54 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when attempting to update approval: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot update approval, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "UpdateApproval";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[Route("approval")]
|
||||
public async Task<IActionResult> DeleteApproval(int approvalID) {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isArgumentError = false;
|
||||
bool isInternalError = false;
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation($"Attempting to delete approval {approvalID}");
|
||||
|
||||
if (approvalID <= 0) throw new ArgumentException("Invalid approval ID");
|
||||
|
||||
await _approvalService.DeleteApproval(approvalID);
|
||||
|
||||
return Ok();
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when attempting to delete approval: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot delete approval, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "UpdateApproval";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -249,26 +250,19 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when attempting to approve: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot approve, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "Approve";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,26 +285,19 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when attempting to deny approval: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Approval denial failed, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "Deny";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -333,26 +320,19 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when attempting to get role ID by role name: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot get role ID, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "GetRoleIdForRoleName";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -376,26 +356,19 @@ public class ApprovalController : ControllerBase {
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
_logger.LogWarning($"Argument error when attempting to get sub roles by sub role name: {errorMessage}");
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot get role ID, because {ex.Message}";
|
||||
_logger.LogError(errorMessage);
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "GetSubRoleIdForSubRoleName";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
_monInClient.PostAverage(metricName + "Latency", millisecondsDiff);
|
||||
|
||||
if (isArgumentError) {
|
||||
_logger.LogWarning(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
} else if (isInternalError) {
|
||||
_logger.LogError(errorMessage);
|
||||
_monInClient.PostStatus(metricName, StatusValue.Critical);
|
||||
} else {
|
||||
_monInClient.PostStatus(metricName, StatusValue.Ok);
|
||||
}
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
}
|
@ -790,6 +790,42 @@ public class PCRBController : ControllerBase {
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("pcrb/notify/approver")]
|
||||
public async Task<IActionResult> NotifyApprover(PCRBNotification notification) {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isArgumentError = false;
|
||||
bool isInternalError = false;
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation("Attempting to notify an approver");
|
||||
|
||||
if (notification is null) throw new ArgumentNullException("notification cannot be null");
|
||||
if (notification.PCRB is null) throw new ArgumentNullException("PCRB cannot be null");
|
||||
if (notification.Approval is null) throw new ArgumentNullException("approval cannot be null");
|
||||
if (string.IsNullOrWhiteSpace(notification.Message)) throw new ArgumentException("message cannot be null or empty");
|
||||
|
||||
await _pcrbService.NotifyApprover(notification);
|
||||
|
||||
return Ok();
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Unable to notify an approver, because {ex.Message}";
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "NotifyPCRBApprover";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("pcrb/notify/approvers")]
|
||||
public async Task<IActionResult> NotifyApprovers(PCRBNotification notification) {
|
||||
@ -937,7 +973,7 @@ public class PCRBController : ControllerBase {
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation($"Attempting to get attendees for plan# {planNumber}");
|
||||
_logger.LogInformation($"Attempting to get follow ups for plan# {planNumber}");
|
||||
|
||||
if (planNumber <= 0) throw new ArgumentException($"{planNumber} is not a valid PCRB Plan#");
|
||||
|
||||
@ -1026,4 +1062,136 @@ public class PCRBController : ControllerBase {
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[Route("pcrb/followUpComment")]
|
||||
public async Task<IActionResult> CreateFollowUpComment(PCRBFollowUpComment comment) {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isArgumentError = false;
|
||||
bool isInternalError = false;
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation("Attempting to create follow up comment");
|
||||
|
||||
if (comment is null) throw new ArgumentNullException("comment cannot be null");
|
||||
|
||||
await _pcrbService.CreateFollowUpComment(comment);
|
||||
|
||||
return Ok();
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Unable to create follow up comment, because {ex.Message}";
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "CreatePCRBFollowUpComment";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("pcrb/followUpComments")]
|
||||
public async Task<IActionResult> GetFollowUpCommentsByPlanNumber(int planNumber, bool bypassCache) {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isArgumentError = false;
|
||||
bool isInternalError = false;
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation($"Attempting to get follow up comments for plan# {planNumber}");
|
||||
|
||||
if (planNumber <= 0) throw new ArgumentException($"{planNumber} is not a valid PCRB Plan#");
|
||||
|
||||
List<PCRBFollowUpComment> comments = (await _pcrbService.GetFollowUpCommentsByPlanNumber(planNumber, bypassCache)).ToList();
|
||||
|
||||
return Ok(comments);
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Cannot get follow up comments for plan# {planNumber}, because {ex.Message}";
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "GetPCRBFollowUpComments";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[Route("pcrb/followUpComment")]
|
||||
public async Task<IActionResult> UpdateFollowUpComment(PCRBFollowUpComment comment) {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isArgumentError = false;
|
||||
bool isInternalError = false;
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation("Attempting to update follow up comment");
|
||||
|
||||
if (comment is null) throw new ArgumentNullException("comment cannot be null");
|
||||
|
||||
await _pcrbService.UpdateFollowUpComment(comment);
|
||||
|
||||
return Ok();
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Unable to update follow up comment, because {ex.Message}";
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "UpdatePCRBFollowUpComment";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
|
||||
[HttpDelete]
|
||||
[Route("pcrb/followUpComment")]
|
||||
public async Task<IActionResult> DeleteFollowUpComment(int id) {
|
||||
DateTime start = DateTime.Now;
|
||||
bool isArgumentError = false;
|
||||
bool isInternalError = false;
|
||||
string errorMessage = "";
|
||||
|
||||
try {
|
||||
_logger.LogInformation("Attempting to delete follow up comment");
|
||||
|
||||
if (id <= 0) throw new ArgumentException($"{id} is not a valid PCRB follow up comment ID");
|
||||
|
||||
await _pcrbService.DeleteFollowUpComment(id);
|
||||
|
||||
return Ok();
|
||||
} catch (ArgumentException ex) {
|
||||
isArgumentError = true;
|
||||
errorMessage = ex.Message;
|
||||
return BadRequest(errorMessage);
|
||||
} catch (Exception ex) {
|
||||
isInternalError = true;
|
||||
errorMessage = $"Unable to delete follow up comment, because {ex.Message}";
|
||||
return Problem(errorMessage);
|
||||
} finally {
|
||||
string metricName = "DeletePCRBFollowUpComment";
|
||||
DateTime end = DateTime.Now;
|
||||
double millisecondsDiff = (end - start).TotalMilliseconds;
|
||||
|
||||
_monInUtils.PostMetrics(metricName, millisecondsDiff, isArgumentError, isInternalError);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user