Add physical delete
This commit is contained in:
		| @@ -0,0 +1,14 @@ | |||||||
|  | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
|  | namespace Core.Inventory.Application.UseCases.Tag.Input | ||||||
|  | { | ||||||
|  |     public class DeleteTagRequest : Notificator, ICommand | ||||||
|  |     { | ||||||
|  |         public string Id { get; set; } = null!; | ||||||
|  |  | ||||||
|  |         public bool Validate() | ||||||
|  |         { | ||||||
|  |             return Id != null; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -17,7 +17,8 @@ namespace Core.Inventory.Application.UseCases.Tag | |||||||
|         IComponentHandler<GetTagRequest>, |         IComponentHandler<GetTagRequest>, | ||||||
|         IComponentHandler<CreateTagRequest>, |         IComponentHandler<CreateTagRequest>, | ||||||
|         IComponentHandler<AddParentTagToTagRequest>, |         IComponentHandler<AddParentTagToTagRequest>, | ||||||
|         IComponentHandler<RemoveParentTagFromTagRequest> |         IComponentHandler<RemoveParentTagFromTagRequest>, | ||||||
|  |         IComponentHandler<DeleteTagRequest> | ||||||
|     { |     { | ||||||
|         private readonly ITagPort _port; |         private readonly ITagPort _port; | ||||||
|         private readonly IValidator<ChangeTagStatusRequest> _changeTagStatusValidator; |         private readonly IValidator<ChangeTagStatusRequest> _changeTagStatusValidator; | ||||||
| @@ -25,6 +26,7 @@ namespace Core.Inventory.Application.UseCases.Tag | |||||||
|         private readonly IValidator<UpdateTagRequest> _updateTagValidator; |         private readonly IValidator<UpdateTagRequest> _updateTagValidator; | ||||||
|         private readonly IValidator<GetAllTagsByListRequest> _TagsByListValidator; |         private readonly IValidator<GetAllTagsByListRequest> _TagsByListValidator; | ||||||
|         private readonly IInventoryServiceClient _inventoryServiceClient; |         private readonly IInventoryServiceClient _inventoryServiceClient; | ||||||
|  |         private readonly IValidator<DeleteTagRequest> _deleteTagValidator; | ||||||
|  |  | ||||||
|         public TagHandler( |         public TagHandler( | ||||||
|             ITagPort port, |             ITagPort port, | ||||||
| @@ -32,6 +34,7 @@ namespace Core.Inventory.Application.UseCases.Tag | |||||||
|             IValidator<CreateTagRequest> registerTagValidator, |             IValidator<CreateTagRequest> registerTagValidator, | ||||||
|             IValidator<UpdateTagRequest> updateTagValidator, |             IValidator<UpdateTagRequest> updateTagValidator, | ||||||
|             IValidator<GetAllTagsByListRequest> TagsByListValidator, |             IValidator<GetAllTagsByListRequest> TagsByListValidator, | ||||||
|  |             IValidator<DeleteTagRequest> deleteTagValidator, | ||||||
|             IInventoryServiceClient inventoryDALService) |             IInventoryServiceClient inventoryDALService) | ||||||
|         { |         { | ||||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); |             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||||
| @@ -40,6 +43,7 @@ namespace Core.Inventory.Application.UseCases.Tag | |||||||
|             _updateTagValidator = updateTagValidator ?? throw new ArgumentNullException(nameof(updateTagValidator)); |             _updateTagValidator = updateTagValidator ?? throw new ArgumentNullException(nameof(updateTagValidator)); | ||||||
|             _inventoryServiceClient = inventoryDALService ?? throw new ArgumentNullException(nameof(inventoryDALService)); |             _inventoryServiceClient = inventoryDALService ?? throw new ArgumentNullException(nameof(inventoryDALService)); | ||||||
|             _TagsByListValidator = TagsByListValidator ?? throw new ArgumentNullException(nameof(TagsByListValidator)); |             _TagsByListValidator = TagsByListValidator ?? throw new ArgumentNullException(nameof(TagsByListValidator)); | ||||||
|  |             _deleteTagValidator = deleteTagValidator ?? throw new ArgumentNullException(nameof(deleteTagValidator)); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public async ValueTask ExecuteAsync(GetTagRequest command, CancellationToken cancellationToken = default) |         public async ValueTask ExecuteAsync(GetTagRequest command, CancellationToken cancellationToken = default) | ||||||
| @@ -262,5 +266,33 @@ namespace Core.Inventory.Application.UseCases.Tag | |||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |                 ApiResponseHelper.EvaluatePort(ex, _port); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public async ValueTask ExecuteAsync(DeleteTagRequest command, CancellationToken cancellationToken = default) | ||||||
|  |         { | ||||||
|  |             try | ||||||
|  |             { | ||||||
|  |                 ArgumentNullException.ThrowIfNull(command); | ||||||
|  |  | ||||||
|  |                 if (!command.IsValid(_deleteTagValidator)) | ||||||
|  |                 { | ||||||
|  |                     _port.ValidationErrors(command.Notifications); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 var result = await _inventoryServiceClient.DeleteTagAsync(command.Id, cancellationToken).ConfigureAwait(false); | ||||||
|  |  | ||||||
|  |                 if (result == null) | ||||||
|  |                 { | ||||||
|  |                     _port.NoContentSuccess(); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 _port.Success(result); | ||||||
|  |             } | ||||||
|  |             catch (Exception ex) | ||||||
|  |             { | ||||||
|  |                 ApiResponseHelper.EvaluatePort(ex, _port); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | using Core.Inventory.Application.UseCases.Tag.Input; | ||||||
|  | using FluentValidation; | ||||||
|  |  | ||||||
|  | namespace Core.Inventory.Application.UseCases.Tag.Validator | ||||||
|  | { | ||||||
|  |     public class DeleteTagValidator : AbstractValidator<DeleteTagRequest> | ||||||
|  |     { | ||||||
|  |         public DeleteTagValidator() | ||||||
|  |         { | ||||||
|  |             RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("Tag Id").WithMessage("Tag Id is Obligatory."); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,14 @@ | |||||||
|  | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
|  | namespace Core.Inventory.Application.UseCases.TagOverride.Input | ||||||
|  | { | ||||||
|  |     public class DeleteTagOverrideRequest : Notificator, ICommand | ||||||
|  |     { | ||||||
|  |         public string Id { get; set; } = null!; | ||||||
|  |  | ||||||
|  |         public bool Validate() | ||||||
|  |         { | ||||||
|  |             return Id != null; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -15,7 +15,8 @@ namespace Core.Inventory.Application.UseCases.TagOverride | |||||||
|         IComponentHandler<GetAllTagOverridesByListRequest>, |         IComponentHandler<GetAllTagOverridesByListRequest>, | ||||||
|         IComponentHandler<UpdateTagOverrideRequest>, |         IComponentHandler<UpdateTagOverrideRequest>, | ||||||
|         IComponentHandler<GetTagOverrideRequest>, |         IComponentHandler<GetTagOverrideRequest>, | ||||||
|         IComponentHandler<CreateTagOverrideRequest> |         IComponentHandler<CreateTagOverrideRequest>, | ||||||
|  |         IComponentHandler<DeleteTagOverrideRequest> | ||||||
|     { |     { | ||||||
|         private readonly ITagOverridePort _port; |         private readonly ITagOverridePort _port; | ||||||
|         private readonly IValidator<ChangeTagOverrideStatusRequest> _changeTagOverrideStatusValidator; |         private readonly IValidator<ChangeTagOverrideStatusRequest> _changeTagOverrideStatusValidator; | ||||||
| @@ -23,6 +24,7 @@ namespace Core.Inventory.Application.UseCases.TagOverride | |||||||
|         private readonly IValidator<UpdateTagOverrideRequest> _updateTagOverrideValidator; |         private readonly IValidator<UpdateTagOverrideRequest> _updateTagOverrideValidator; | ||||||
|         private readonly IValidator<GetAllTagOverridesByListRequest> _TagOverridesByListValidator; |         private readonly IValidator<GetAllTagOverridesByListRequest> _TagOverridesByListValidator; | ||||||
|         private readonly IInventoryServiceClient _inventoryServiceClient; |         private readonly IInventoryServiceClient _inventoryServiceClient; | ||||||
|  |         private readonly IValidator<DeleteTagOverrideRequest> _deleteTagOverrideValidator; | ||||||
|  |  | ||||||
|         public TagOverrideHandler( |         public TagOverrideHandler( | ||||||
|             ITagOverridePort port, |             ITagOverridePort port, | ||||||
| @@ -30,6 +32,7 @@ namespace Core.Inventory.Application.UseCases.TagOverride | |||||||
|             IValidator<CreateTagOverrideRequest> registerTagOverrideValidator, |             IValidator<CreateTagOverrideRequest> registerTagOverrideValidator, | ||||||
|             IValidator<UpdateTagOverrideRequest> updateTagOverrideValidator, |             IValidator<UpdateTagOverrideRequest> updateTagOverrideValidator, | ||||||
|             IValidator<GetAllTagOverridesByListRequest> TagOverridesByListValidator, |             IValidator<GetAllTagOverridesByListRequest> TagOverridesByListValidator, | ||||||
|  |             IValidator<DeleteTagOverrideRequest> deleteTagOverrideValidator, | ||||||
|             IInventoryServiceClient inventoryDALService) |             IInventoryServiceClient inventoryDALService) | ||||||
|         { |         { | ||||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); |             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||||
| @@ -38,6 +41,7 @@ namespace Core.Inventory.Application.UseCases.TagOverride | |||||||
|             _updateTagOverrideValidator = updateTagOverrideValidator ?? throw new ArgumentNullException(nameof(updateTagOverrideValidator)); |             _updateTagOverrideValidator = updateTagOverrideValidator ?? throw new ArgumentNullException(nameof(updateTagOverrideValidator)); | ||||||
|             _inventoryServiceClient = inventoryDALService ?? throw new ArgumentNullException(nameof(inventoryDALService)); |             _inventoryServiceClient = inventoryDALService ?? throw new ArgumentNullException(nameof(inventoryDALService)); | ||||||
|             _TagOverridesByListValidator = TagOverridesByListValidator ?? throw new ArgumentNullException(nameof(TagOverridesByListValidator)); |             _TagOverridesByListValidator = TagOverridesByListValidator ?? throw new ArgumentNullException(nameof(TagOverridesByListValidator)); | ||||||
|  |             _deleteTagOverrideValidator = deleteTagOverrideValidator ?? throw new ArgumentNullException(nameof(deleteTagOverrideValidator)); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public async ValueTask ExecuteAsync(GetTagOverrideRequest command, CancellationToken cancellationToken = default) |         public async ValueTask ExecuteAsync(GetTagOverrideRequest command, CancellationToken cancellationToken = default) | ||||||
| @@ -208,5 +212,33 @@ namespace Core.Inventory.Application.UseCases.TagOverride | |||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |                 ApiResponseHelper.EvaluatePort(ex, _port); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public async ValueTask ExecuteAsync(DeleteTagOverrideRequest command, CancellationToken cancellationToken = default) | ||||||
|  |         { | ||||||
|  |             try | ||||||
|  |             { | ||||||
|  |                 ArgumentNullException.ThrowIfNull(command); | ||||||
|  |  | ||||||
|  |                 if (!command.IsValid(_deleteTagOverrideValidator)) | ||||||
|  |                 { | ||||||
|  |                     _port.ValidationErrors(command.Notifications); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 var result = await _inventoryServiceClient.DeleteTagOverrideAsync(command.Id, cancellationToken).ConfigureAwait(false); | ||||||
|  |  | ||||||
|  |                 if (result == null) | ||||||
|  |                 { | ||||||
|  |                     _port.NoContentSuccess(); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 _port.Success(result); | ||||||
|  |             } | ||||||
|  |             catch (Exception ex) | ||||||
|  |             { | ||||||
|  |                 ApiResponseHelper.EvaluatePort(ex, _port); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | using Core.Inventory.Application.UseCases.TagOverride.Input; | ||||||
|  | using FluentValidation; | ||||||
|  |  | ||||||
|  | namespace Core.Inventory.Application.UseCases.TagOverride.Validator | ||||||
|  | { | ||||||
|  |     public class DeleteTagOverrideValidator : AbstractValidator<DeleteTagOverrideRequest> | ||||||
|  |     { | ||||||
|  |         public DeleteTagOverrideValidator() | ||||||
|  |         { | ||||||
|  |             RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("TagOverride Id").WithMessage("TagOverride Id is Obligatory."); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -0,0 +1,14 @@ | |||||||
|  | using Lib.Architecture.BuildingBlocks; | ||||||
|  |  | ||||||
|  | namespace Core.Inventory.Application.UseCases.TagType.Input | ||||||
|  | { | ||||||
|  |     public class DeleteTagTypeRequest : Notificator, ICommand | ||||||
|  |     { | ||||||
|  |         public string Id { get; set; } = null!; | ||||||
|  |  | ||||||
|  |         public bool Validate() | ||||||
|  |         { | ||||||
|  |             return Id != null; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -15,13 +15,15 @@ namespace Core.Inventory.Application.UseCases.TagType | |||||||
|         IComponentHandler<GetAllTagTypesByListRequest>, |         IComponentHandler<GetAllTagTypesByListRequest>, | ||||||
|         IComponentHandler<UpdateTagTypeRequest>, |         IComponentHandler<UpdateTagTypeRequest>, | ||||||
|         IComponentHandler<GetTagTypeRequest>, |         IComponentHandler<GetTagTypeRequest>, | ||||||
|         IComponentHandler<CreateTagTypeRequest> |         IComponentHandler<CreateTagTypeRequest>, | ||||||
|  |         IComponentHandler<DeleteTagTypeRequest> | ||||||
|     { |     { | ||||||
|         private readonly ITagTypePort _port; |         private readonly ITagTypePort _port; | ||||||
|         private readonly IValidator<ChangeTagTypeStatusRequest> _changeTagTypeStatusValidator; |         private readonly IValidator<ChangeTagTypeStatusRequest> _changeTagTypeStatusValidator; | ||||||
|         private readonly IValidator<CreateTagTypeRequest> _registerTagTypeValidator; |         private readonly IValidator<CreateTagTypeRequest> _registerTagTypeValidator; | ||||||
|         private readonly IValidator<UpdateTagTypeRequest> _updateTagTypeValidator; |         private readonly IValidator<UpdateTagTypeRequest> _updateTagTypeValidator; | ||||||
|         private readonly IValidator<GetAllTagTypesByListRequest> _TagTypesByListValidator; |         private readonly IValidator<GetAllTagTypesByListRequest> _TagTypesByListValidator; | ||||||
|  |         private readonly IValidator<DeleteTagTypeRequest> _deleteTagTypeValidator; | ||||||
|         private readonly IInventoryServiceClient _inventoryServiceClient; |         private readonly IInventoryServiceClient _inventoryServiceClient; | ||||||
|  |  | ||||||
|         public TagTypeHandler( |         public TagTypeHandler( | ||||||
| @@ -30,6 +32,7 @@ namespace Core.Inventory.Application.UseCases.TagType | |||||||
|             IValidator<CreateTagTypeRequest> registerTagTypeValidator, |             IValidator<CreateTagTypeRequest> registerTagTypeValidator, | ||||||
|             IValidator<UpdateTagTypeRequest> updateTagTypeValidator, |             IValidator<UpdateTagTypeRequest> updateTagTypeValidator, | ||||||
|             IValidator<GetAllTagTypesByListRequest> TagTypesByListValidator, |             IValidator<GetAllTagTypesByListRequest> TagTypesByListValidator, | ||||||
|  |             IValidator<DeleteTagTypeRequest> deleteTagTypeValidator, | ||||||
|             IInventoryServiceClient inventoryDALService) |             IInventoryServiceClient inventoryDALService) | ||||||
|         { |         { | ||||||
|             _port = port ?? throw new ArgumentNullException(nameof(port)); |             _port = port ?? throw new ArgumentNullException(nameof(port)); | ||||||
| @@ -38,6 +41,7 @@ namespace Core.Inventory.Application.UseCases.TagType | |||||||
|             _updateTagTypeValidator = updateTagTypeValidator ?? throw new ArgumentNullException(nameof(updateTagTypeValidator)); |             _updateTagTypeValidator = updateTagTypeValidator ?? throw new ArgumentNullException(nameof(updateTagTypeValidator)); | ||||||
|             _inventoryServiceClient = inventoryDALService ?? throw new ArgumentNullException(nameof(inventoryDALService)); |             _inventoryServiceClient = inventoryDALService ?? throw new ArgumentNullException(nameof(inventoryDALService)); | ||||||
|             _TagTypesByListValidator = TagTypesByListValidator ?? throw new ArgumentNullException(nameof(TagTypesByListValidator)); |             _TagTypesByListValidator = TagTypesByListValidator ?? throw new ArgumentNullException(nameof(TagTypesByListValidator)); | ||||||
|  |             _deleteTagTypeValidator = deleteTagTypeValidator ?? throw new ArgumentNullException(nameof(deleteTagTypeValidator)); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         public async ValueTask ExecuteAsync(GetTagTypeRequest command, CancellationToken cancellationToken = default) |         public async ValueTask ExecuteAsync(GetTagTypeRequest command, CancellationToken cancellationToken = default) | ||||||
| @@ -210,5 +214,33 @@ namespace Core.Inventory.Application.UseCases.TagType | |||||||
|                 ApiResponseHelper.EvaluatePort(ex, _port); |                 ApiResponseHelper.EvaluatePort(ex, _port); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         public async ValueTask ExecuteAsync(DeleteTagTypeRequest command, CancellationToken cancellationToken = default) | ||||||
|  |         { | ||||||
|  |             try | ||||||
|  |             { | ||||||
|  |                 ArgumentNullException.ThrowIfNull(command); | ||||||
|  |  | ||||||
|  |                 if (!command.IsValid(_deleteTagTypeValidator)) | ||||||
|  |                 { | ||||||
|  |                     _port.ValidationErrors(command.Notifications); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 var result = await _inventoryServiceClient.DeleteTagTypeAsync(command.Id, cancellationToken).ConfigureAwait(false); | ||||||
|  |  | ||||||
|  |                 if (result == null) | ||||||
|  |                 { | ||||||
|  |                     _port.NoContentSuccess(); | ||||||
|  |                     return; | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 _port.Success(result); | ||||||
|  |             } | ||||||
|  |             catch (Exception ex) | ||||||
|  |             { | ||||||
|  |                 ApiResponseHelper.EvaluatePort(ex, _port); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -0,0 +1,13 @@ | |||||||
|  | using Core.Inventory.Application.UseCases.TagType.Input; | ||||||
|  | using FluentValidation; | ||||||
|  |  | ||||||
|  | namespace Core.Inventory.Application.UseCases.TagType.Validator | ||||||
|  | { | ||||||
|  |     public class DeleteTagTypeValidator : AbstractValidator<DeleteTagTypeRequest> | ||||||
|  |     { | ||||||
|  |         public DeleteTagTypeValidator() | ||||||
|  |         { | ||||||
|  |             RuleFor(i => i.Id).NotEmpty().NotNull().OverridePropertyName(x => x.Id).WithName("TagType Id").WithMessage("TagType Id is Obligatory."); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
| @@ -73,6 +73,9 @@ namespace Core.Inventory.External.Clients | |||||||
|         [Patch("/api/v1/TagType/{id}/{newStatus}/ChangeStatus")] |         [Patch("/api/v1/TagType/{id}/{newStatus}/ChangeStatus")] | ||||||
|         Task<TagTypeAdapter> ChangeStatusTagTypeAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<TagTypeAdapter> ChangeStatusTagTypeAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|  |         [Delete("/api/v1/TagType/{id}")] | ||||||
|  |         Task<TagTypeAdapter> DeleteTagTypeAsync([FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         #endregion |         #endregion | ||||||
|  |  | ||||||
|         #region Tag |         #region Tag | ||||||
| @@ -101,6 +104,9 @@ namespace Core.Inventory.External.Clients | |||||||
|         [Delete("/api/v1/Tag/{tagId}/ParentTags/{parentTagId}/Remove")] |         [Delete("/api/v1/Tag/{tagId}/ParentTags/{parentTagId}/Remove")] | ||||||
|         Task<TagAdapter> RemoveParentTagAsync([FromRoute] string tagId, [FromRoute] string parentTagId, CancellationToken cancellationToken = default); |         Task<TagAdapter> RemoveParentTagAsync([FromRoute] string tagId, [FromRoute] string parentTagId, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|  |         [Delete("/api/v1/Tag/{id}")] | ||||||
|  |         Task<TagAdapter> DeleteTagAsync([FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         #endregion |         #endregion | ||||||
|  |  | ||||||
|         #region TagOverride |         #region TagOverride | ||||||
| @@ -123,6 +129,9 @@ namespace Core.Inventory.External.Clients | |||||||
|         [Patch("/api/v1/TagOverride/{id}/{newStatus}/ChangeStatus")] |         [Patch("/api/v1/TagOverride/{id}/{newStatus}/ChangeStatus")] | ||||||
|         Task<TagOverrideAdapter> ChangeStatusTagOverrideAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); |         Task<TagOverrideAdapter> ChangeStatusTagOverrideAsync([FromRoute] string id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|  |         [Delete("/api/v1/TagOverride/{id}")] | ||||||
|  |         Task<TagOverrideAdapter> DeleteTagOverrideAsync([FromRoute] string id, CancellationToken cancellationToken = default); | ||||||
|  |  | ||||||
|         #endregion |         #endregion | ||||||
|  |  | ||||||
|         #region Product |         #region Product | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| using Core.Adapters.Lib; | using Core.Adapters.Lib; | ||||||
| using Core.Inventory.Application.UseCases.Tag.Input; | using Core.Inventory.Application.UseCases.Tag.Input; | ||||||
| using Core.Inventory.Application.UseCases.Tag.Ports; | using Core.Inventory.Application.UseCases.Tag.Ports; | ||||||
|  | using Core.Inventory.Application.UseCases.TagType.Input; | ||||||
| using Lib.Architecture.BuildingBlocks; | using Lib.Architecture.BuildingBlocks; | ||||||
| using Microsoft.AspNetCore.Authorization; | using Microsoft.AspNetCore.Authorization; | ||||||
| using Microsoft.AspNetCore.Mvc; | using Microsoft.AspNetCore.Mvc; | ||||||
| @@ -26,6 +27,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|         private readonly IComponentHandler<ChangeTagStatusRequest> changeTagStatusHandler; |         private readonly IComponentHandler<ChangeTagStatusRequest> changeTagStatusHandler; | ||||||
|         private readonly IComponentHandler<AddParentTagToTagRequest> addParentTagToTagHandler; |         private readonly IComponentHandler<AddParentTagToTagRequest> addParentTagToTagHandler; | ||||||
|         private readonly IComponentHandler<RemoveParentTagFromTagRequest> removeParentTagFromTagUserHandler; |         private readonly IComponentHandler<RemoveParentTagFromTagRequest> removeParentTagFromTagUserHandler; | ||||||
|  |         private readonly IComponentHandler<DeleteTagRequest> deleteTagHandler; | ||||||
|         private readonly ITagPort port; |         private readonly ITagPort port; | ||||||
|  |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @@ -40,6 +42,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|             IComponentHandler<ChangeTagStatusRequest> changeTagStatusHandler, |             IComponentHandler<ChangeTagStatusRequest> changeTagStatusHandler, | ||||||
|             IComponentHandler<AddParentTagToTagRequest> addParentTagToTagHandler, |             IComponentHandler<AddParentTagToTagRequest> addParentTagToTagHandler, | ||||||
|             IComponentHandler<RemoveParentTagFromTagRequest> removeParentTagFromTagUserHandler, |             IComponentHandler<RemoveParentTagFromTagRequest> removeParentTagFromTagUserHandler, | ||||||
|  |             IComponentHandler<DeleteTagRequest> deleteTagHandler, | ||||||
|             ITagPort port |             ITagPort port | ||||||
|             ) |             ) | ||||||
|         { |         { | ||||||
| @@ -51,6 +54,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|             this.getAllTagsByListHandler = getAllTagsByListHandler; |             this.getAllTagsByListHandler = getAllTagsByListHandler; | ||||||
|             this.addParentTagToTagHandler = addParentTagToTagHandler; |             this.addParentTagToTagHandler = addParentTagToTagHandler; | ||||||
|             this.removeParentTagFromTagUserHandler = removeParentTagFromTagUserHandler; |             this.removeParentTagFromTagUserHandler = removeParentTagFromTagUserHandler; | ||||||
|  |             this.deleteTagHandler = deleteTagHandler; | ||||||
|             this.port = port; |             this.port = port; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -235,5 +239,23 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|  |  | ||||||
|             return port.ViewModel; |             return port.ViewModel; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         /// <summary> | ||||||
|  |         /// Deletes a full Tag by identifier. | ||||||
|  |         /// </summary> | ||||||
|  |         [HttpDelete("Delete")] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status200OK)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status204NoContent)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||||
|  |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|  |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|  |         public async Task<IActionResult> UpdateTagAsync([FromBody] DeleteTagRequest request, CancellationToken cancellationToken = default) | ||||||
|  |         { | ||||||
|  |             await deleteTagHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); | ||||||
|  |  | ||||||
|  |             return port.ViewModel; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|         private readonly IComponentHandler<CreateTagOverrideRequest> createTagOverrideHandler; |         private readonly IComponentHandler<CreateTagOverrideRequest> createTagOverrideHandler; | ||||||
|         private readonly IComponentHandler<UpdateTagOverrideRequest> updateTagOverrideHandler; |         private readonly IComponentHandler<UpdateTagOverrideRequest> updateTagOverrideHandler; | ||||||
|         private readonly IComponentHandler<ChangeTagOverrideStatusRequest> changeTagOverrideStatusHandler; |         private readonly IComponentHandler<ChangeTagOverrideStatusRequest> changeTagOverrideStatusHandler; | ||||||
|  |         private readonly IComponentHandler<DeleteTagOverrideRequest> deleteTagOverrideHandler; | ||||||
|         private readonly ITagOverridePort port; |         private readonly ITagOverridePort port; | ||||||
|  |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @@ -36,6 +37,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|             IComponentHandler<CreateTagOverrideRequest> createTagOverrideHandler, |             IComponentHandler<CreateTagOverrideRequest> createTagOverrideHandler, | ||||||
|             IComponentHandler<UpdateTagOverrideRequest> updateTagOverrideHandler, |             IComponentHandler<UpdateTagOverrideRequest> updateTagOverrideHandler, | ||||||
|             IComponentHandler<ChangeTagOverrideStatusRequest> changeTagOverrideStatusHandler, |             IComponentHandler<ChangeTagOverrideStatusRequest> changeTagOverrideStatusHandler, | ||||||
|  |             IComponentHandler<DeleteTagOverrideRequest> deleteTagOverrideHandler, | ||||||
|             ITagOverridePort port |             ITagOverridePort port | ||||||
|             ) |             ) | ||||||
|         { |         { | ||||||
| @@ -45,6 +47,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|             this.getAllTagOverridesHandler = getAllTagOverridesHandler; |             this.getAllTagOverridesHandler = getAllTagOverridesHandler; | ||||||
|             this.getTagOverrideHandler = getTagOverrideHandler; |             this.getTagOverrideHandler = getTagOverrideHandler; | ||||||
|             this.getAllTagOverridesByListHandler = getAllTagOverridesByListHandler; |             this.getAllTagOverridesByListHandler = getAllTagOverridesByListHandler; | ||||||
|  |             this.deleteTagOverrideHandler = deleteTagOverrideHandler; | ||||||
|             this.port = port; |             this.port = port; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -183,5 +186,23 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|  |  | ||||||
|             return port.ViewModel; |             return port.ViewModel; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         /// <summary> | ||||||
|  |         /// Deletes a full TagOverride by identifier. | ||||||
|  |         /// </summary> | ||||||
|  |         [HttpDelete("Delete")] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status200OK)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status204NoContent)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||||
|  |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|  |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|  |         public async Task<IActionResult> UpdateTagOverrideAsync([FromBody] DeleteTagOverrideRequest request, CancellationToken cancellationToken = default) | ||||||
|  |         { | ||||||
|  |             await deleteTagOverrideHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); | ||||||
|  |  | ||||||
|  |             return port.ViewModel; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -24,6 +24,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|         private readonly IComponentHandler<CreateTagTypeRequest> createTagTypeHandler; |         private readonly IComponentHandler<CreateTagTypeRequest> createTagTypeHandler; | ||||||
|         private readonly IComponentHandler<UpdateTagTypeRequest> updateTagTypeHandler; |         private readonly IComponentHandler<UpdateTagTypeRequest> updateTagTypeHandler; | ||||||
|         private readonly IComponentHandler<ChangeTagTypeStatusRequest> changeTagTypeStatusHandler; |         private readonly IComponentHandler<ChangeTagTypeStatusRequest> changeTagTypeStatusHandler; | ||||||
|  |         private readonly IComponentHandler<DeleteTagTypeRequest> deleteTagTypeHandler; | ||||||
|         private readonly ITagTypePort port; |         private readonly ITagTypePort port; | ||||||
|  |  | ||||||
|         /// <summary> |         /// <summary> | ||||||
| @@ -36,6 +37,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|             IComponentHandler<CreateTagTypeRequest> createTagTypeHandler, |             IComponentHandler<CreateTagTypeRequest> createTagTypeHandler, | ||||||
|             IComponentHandler<UpdateTagTypeRequest> updateTagTypeHandler, |             IComponentHandler<UpdateTagTypeRequest> updateTagTypeHandler, | ||||||
|             IComponentHandler<ChangeTagTypeStatusRequest> changeTagTypeStatusHandler, |             IComponentHandler<ChangeTagTypeStatusRequest> changeTagTypeStatusHandler, | ||||||
|  |             IComponentHandler<DeleteTagTypeRequest> deleteTagTypeHandler, | ||||||
|             ITagTypePort port |             ITagTypePort port | ||||||
|             ) |             ) | ||||||
|         { |         { | ||||||
| @@ -45,6 +47,7 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|             this.getAllTagTypesHandler = getAllTagTypesHandler; |             this.getAllTagTypesHandler = getAllTagTypesHandler; | ||||||
|             this.getTagTypeHandler = getTagTypeHandler; |             this.getTagTypeHandler = getTagTypeHandler; | ||||||
|             this.getAllTagTypesByListHandler = getAllTagTypesByListHandler; |             this.getAllTagTypesByListHandler = getAllTagTypesByListHandler; | ||||||
|  |             this.deleteTagTypeHandler = deleteTagTypeHandler; | ||||||
|             this.port = port; |             this.port = port; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -183,5 +186,23 @@ namespace Core.Inventory.Service.API.Controllers | |||||||
|  |  | ||||||
|             return port.ViewModel; |             return port.ViewModel; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         /// <summary> | ||||||
|  |         /// Deletes a full TagType by identifier. | ||||||
|  |         /// </summary> | ||||||
|  |         [HttpDelete("Delete")] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status200OK)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status204NoContent)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status401Unauthorized)] | ||||||
|  |         [ProducesResponseType(typeof(Notification), StatusCodes.Status412PreconditionFailed)] | ||||||
|  |         [ProducesResponseType(typeof(Notification), StatusCodes.Status422UnprocessableEntity)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status500InternalServerError)] | ||||||
|  |         [ProducesResponseType(StatusCodes.Status400BadRequest)] | ||||||
|  |         public async Task<IActionResult> UpdateTagTypeAsync([FromBody] DeleteTagTypeRequest request, CancellationToken cancellationToken = default) | ||||||
|  |         { | ||||||
|  |             await deleteTagTypeHandler.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); | ||||||
|  |  | ||||||
|  |             return port.ViewModel; | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -108,6 +108,10 @@ namespace Core.Inventory.Service.API.Extensions | |||||||
|             services.AddScoped<IValidator<ChangeTagTypeStatusRequest>, ChangeTagTypeStatusValidator>(); |             services.AddScoped<IValidator<ChangeTagTypeStatusRequest>, ChangeTagTypeStatusValidator>(); | ||||||
|             services.AddScoped<IComponentHandler<ChangeTagTypeStatusRequest>, TagTypeHandler>(); |             services.AddScoped<IComponentHandler<ChangeTagTypeStatusRequest>, TagTypeHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<DeleteTagTypeValidator>(); | ||||||
|  |             services.AddScoped<IValidator<DeleteTagTypeRequest>, DeleteTagTypeValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<DeleteTagTypeRequest>, TagTypeHandler>(); | ||||||
|  |  | ||||||
|             #endregion |             #endregion | ||||||
|  |  | ||||||
|             #region Tag Services |             #region Tag Services | ||||||
| @@ -135,6 +139,10 @@ namespace Core.Inventory.Service.API.Extensions | |||||||
|             services.AddScoped<IComponentHandler<AddParentTagToTagRequest>, TagHandler>(); |             services.AddScoped<IComponentHandler<AddParentTagToTagRequest>, TagHandler>(); | ||||||
|             services.AddScoped<IComponentHandler<RemoveParentTagFromTagRequest>, TagHandler>(); |             services.AddScoped<IComponentHandler<RemoveParentTagFromTagRequest>, TagHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<DeleteTagValidator>(); | ||||||
|  |             services.AddScoped<IValidator<DeleteTagRequest>, DeleteTagValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<DeleteTagRequest>, TagHandler>(); | ||||||
|  |  | ||||||
|             #endregion |             #endregion | ||||||
|  |  | ||||||
|             #region TagOverride Services |             #region TagOverride Services | ||||||
| @@ -159,6 +167,10 @@ namespace Core.Inventory.Service.API.Extensions | |||||||
|             services.AddScoped<IValidator<ChangeTagOverrideStatusRequest>, ChangeTagOverrideStatusValidator>(); |             services.AddScoped<IValidator<ChangeTagOverrideStatusRequest>, ChangeTagOverrideStatusValidator>(); | ||||||
|             services.AddScoped<IComponentHandler<ChangeTagOverrideStatusRequest>, TagOverrideHandler>(); |             services.AddScoped<IComponentHandler<ChangeTagOverrideStatusRequest>, TagOverrideHandler>(); | ||||||
|  |  | ||||||
|  |             services.AddValidatorsFromAssemblyContaining<DeleteTagOverrideValidator>(); | ||||||
|  |             services.AddScoped<IValidator<DeleteTagOverrideRequest>, DeleteTagOverrideValidator>(); | ||||||
|  |             services.AddScoped<IComponentHandler<DeleteTagOverrideRequest>, TagOverrideHandler>(); | ||||||
|  |  | ||||||
|             #endregion |             #endregion | ||||||
|  |  | ||||||
|             #region Product Services |             #region Product Services | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Oscar Morales
					Oscar Morales