Add physical delete
This commit is contained in:
		| @@ -2,6 +2,7 @@ | ||||
| using Core.Adapters.Lib; | ||||
| using Core.Inventory.External.Clients.Inventory; | ||||
| using Core.Inventory.External.Clients.Inventory.Requests.Tag; | ||||
| using Core.Inventory.External.Clients.Inventory.Requests.TagType; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| @@ -257,5 +258,34 @@ namespace Core.Inventory.BFF.API.Controllers | ||||
|                 throw; | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Deletes a full Tag by identifier. | ||||
|         /// </summary> | ||||
|         [HttpDelete("Delete")] | ||||
|         [ProducesResponseType(StatusCodes.Status200OK)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         public async Task<IActionResult> DeleteTagService(DeleteTagRequest request, CancellationToken cancellationToken) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 logger.LogInformation($"{nameof(DeleteTagService)} - Request received - Payload: {JsonSerializer.Serialize(request)}"); | ||||
|  | ||||
|                 if (request == null) return BadRequest("Invalid Tag object"); | ||||
|  | ||||
|                 if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid Tag identifier"); | ||||
|  | ||||
|                 return await Handle(() => inventoryServiceClient.DeleteTagService(request, cancellationToken)).ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 logger.LogError($"{nameof(DeleteTagService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}"); | ||||
|                 throw; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -2,6 +2,7 @@ | ||||
| using Core.Adapters.Lib; | ||||
| using Core.Inventory.External.Clients.Inventory; | ||||
| using Core.Inventory.External.Clients.Inventory.Requests.TagOverride; | ||||
| using Core.Inventory.External.Clients.Inventory.Requests.TagType; | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
| using Microsoft.AspNetCore.Authorization; | ||||
| using Microsoft.AspNetCore.Mvc; | ||||
| @@ -202,6 +203,33 @@ namespace Core.Inventory.BFF.API.Controllers | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Deletes a full TagOverride by identifier. | ||||
|         /// </summary> | ||||
|         [HttpDelete("Delete")] | ||||
|         [ProducesResponseType(StatusCodes.Status200OK)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         public async Task<IActionResult> DeleteTagOverrideService(DeleteTagOverrideRequest request, CancellationToken cancellationToken) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 logger.LogInformation($"{nameof(DeleteTagOverrideService)} - Request received - Payload: {JsonSerializer.Serialize(request)}"); | ||||
|  | ||||
|                 if (request == null) return BadRequest("Invalid TagOverride object"); | ||||
|  | ||||
|                 if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid TagOverride identifier"); | ||||
|  | ||||
|                 return await Handle(() => inventoryServiceClient.DeleteTagOverrideService(request, cancellationToken)).ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 logger.LogError($"{nameof(DeleteTagOverrideService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}"); | ||||
|                 throw; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -198,6 +198,33 @@ namespace Core.Inventory.BFF.API.Controllers | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Deletes a full TagType by identifier. | ||||
|         /// </summary> | ||||
|         [HttpDelete("Delete")] | ||||
|         [ProducesResponseType(StatusCodes.Status200OK)] | ||||
|         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||
|         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||
|         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||
|         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||
|         public async Task<IActionResult> DeleteTagTypeService(DeleteTagTypeRequest request, CancellationToken cancellationToken) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 logger.LogInformation($"{nameof(DeleteTagTypeService)} - Request received - Payload: {JsonSerializer.Serialize(request)}"); | ||||
|  | ||||
|                 if (request == null) return BadRequest("Invalid TagType object"); | ||||
|  | ||||
|                 if (string.IsNullOrEmpty(request.Id)) return BadRequest("Invalid TagType identifier"); | ||||
|  | ||||
|                 return await Handle(() => inventoryServiceClient.DeleteTagTypeService(request, cancellationToken)).ConfigureAwait(false); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 logger.LogError($"{nameof(DeleteTagTypeService)} - An Error Occurred- {ex.Message} - {ex.InnerException} - {ex.StackTrace} - with payload {JsonSerializer.Serialize(request)}"); | ||||
|                 throw; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Oscar Morales
					Oscar Morales