diff --git a/Core.Inventory.DAL.API/Controllers/TagController.cs b/Core.Inventory.DAL.API/Controllers/TagController.cs
index 0b1426e..26a9d00 100644
--- a/Core.Inventory.DAL.API/Controllers/TagController.cs
+++ b/Core.Inventory.DAL.API/Controllers/TagController.cs
@@ -186,5 +186,27 @@ namespace Core.Inventory.DAL.API.Controllers
var result = await service.RemoveParentTag(tagId, parentTagId, cancellationToken).ConfigureAwait(false); ;
return Ok(result);
}
+
+ ///
+ /// Deletes a Tag by its MongoDB identifier.
+ ///
+ /// The Tag MongoDB identifier.
+ /// The result of the delete operation.
+ /// The Tag deleted successfully.
+ /// The Tag not found.
+ /// The service internal error.
+ [HttpDelete]
+ [Route("{id}")]
+ [Consumes(MimeTypes.ApplicationJson)]
+ [Produces(MimeTypes.ApplicationJson)]
+ [ProducesResponseType(typeof(TagAdapter), StatusCodes.Status200OK)]
+ public async Task DeleteTag([FromRoute] string id, CancellationToken cancellationToken)
+ {
+ var result = await service.DeleteTag(id, cancellationToken).ConfigureAwait(false);
+
+ if (result is null) return NotFound("Tag not found");
+
+ return Ok(result);
+ }
}
}
diff --git a/Core.Inventory.DAL.API/Controllers/TagOverrideController.cs b/Core.Inventory.DAL.API/Controllers/TagOverrideController.cs
index cf9d423..9957e83 100644
--- a/Core.Inventory.DAL.API/Controllers/TagOverrideController.cs
+++ b/Core.Inventory.DAL.API/Controllers/TagOverrideController.cs
@@ -150,5 +150,27 @@ namespace Core.Inventory.DAL.API.Controllers
var result = await service.ChangeTagOverrideStatus(id, newStatus, cancellationToken).ConfigureAwait(false);
return Ok(result);
}
+
+ ///
+ /// Deletes a TagOverride by its MongoDB identifier.
+ ///
+ /// The TagOverride MongoDB identifier.
+ /// The result of the delete operation.
+ /// The TagOverride deleted successfully.
+ /// The TagOverride not found.
+ /// The service internal error.
+ [HttpDelete]
+ [Route("{id}")]
+ [Consumes(MimeTypes.ApplicationJson)]
+ [Produces(MimeTypes.ApplicationJson)]
+ [ProducesResponseType(typeof(TagOverrideAdapter), StatusCodes.Status200OK)]
+ public async Task DeleteTagOverride([FromRoute] string id, CancellationToken cancellationToken)
+ {
+ var result = await service.DeleteTagOverride(id, cancellationToken).ConfigureAwait(false);
+
+ if (result is null) return NotFound("TagOverride not found");
+
+ return Ok(result);
+ }
}
}
\ No newline at end of file
diff --git a/Core.Inventory.DAL.API/Controllers/TagTypeController.cs b/Core.Inventory.DAL.API/Controllers/TagTypeController.cs
index 77a3f13..86537aa 100644
--- a/Core.Inventory.DAL.API/Controllers/TagTypeController.cs
+++ b/Core.Inventory.DAL.API/Controllers/TagTypeController.cs
@@ -150,5 +150,27 @@ namespace Core.Inventory.DAL.API.Controllers
var result = await service.ChangeTagTypeStatus(id, newStatus, cancellationToken).ConfigureAwait(false);
return Ok(result);
}
+
+ ///
+ /// Deletes a TagType by its MongoDB identifier.
+ ///
+ /// The TagType MongoDB identifier.
+ /// The result of the delete operation.
+ /// The TagType deleted successfully.
+ /// The TagType not found.
+ /// The service internal error.
+ [HttpDelete]
+ [Route("{id}")]
+ [Consumes(MimeTypes.ApplicationJson)]
+ [Produces(MimeTypes.ApplicationJson)]
+ [ProducesResponseType(typeof(TagTypeAdapter), StatusCodes.Status200OK)]
+ public async Task DeleteTagType([FromRoute] string id, CancellationToken cancellationToken)
+ {
+ var result = await service.DeleteTagType(id, cancellationToken).ConfigureAwait(false);
+
+ if (result is null) return NotFound("TagType not found");
+
+ return Ok(result);
+ }
}
}
diff --git a/Core.Inventory.Provider/Contracts/ITagOverrideProvider.cs b/Core.Inventory.Provider/Contracts/ITagOverrideProvider.cs
index 4171cb9..6ea8199 100644
--- a/Core.Inventory.Provider/Contracts/ITagOverrideProvider.cs
+++ b/Core.Inventory.Provider/Contracts/ITagOverrideProvider.cs
@@ -55,5 +55,13 @@ namespace Core.Inventory.Provider.Contracts
/// A representing
/// the asynchronous execution of the service.
ValueTask UpdateTagOverride(TagOverrideAdapter entity, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes a TagOverride by its MongoDB identifier.
+ ///
+ /// The TagOverride MongoDB identifier.
+ /// A representing
+ /// the asynchronous execution of the service.
+ ValueTask DeleteTagOverride(string tagOverrideId, CancellationToken cancellationToken);
}
}
diff --git a/Core.Inventory.Provider/Contracts/ITagProvider.cs b/Core.Inventory.Provider/Contracts/ITagProvider.cs
index 10c3108..823f004 100644
--- a/Core.Inventory.Provider/Contracts/ITagProvider.cs
+++ b/Core.Inventory.Provider/Contracts/ITagProvider.cs
@@ -71,5 +71,13 @@ namespace Core.Inventory.Provider.Contracts
/// The identifier of the parentTag to add.
/// A representing the asynchronous operation, with the updated tag object.
ValueTask RemoveParentTag(string tagId, string parentTagId, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes a Tag by its MongoDB identifier.
+ ///
+ /// The Tag MongoDB identifier.
+ /// A representing
+ /// the asynchronous execution of the service.
+ ValueTask DeleteTag(string tagId, CancellationToken cancellationToken);
}
}
diff --git a/Core.Inventory.Provider/Contracts/ITagTypeProvider.cs b/Core.Inventory.Provider/Contracts/ITagTypeProvider.cs
index 9c0b567..d410bb2 100644
--- a/Core.Inventory.Provider/Contracts/ITagTypeProvider.cs
+++ b/Core.Inventory.Provider/Contracts/ITagTypeProvider.cs
@@ -55,5 +55,13 @@ namespace Core.Inventory.Provider.Contracts
/// A representing
/// the asynchronous execution of the service.
ValueTask UpdateTagType(TagTypeAdapter entity, CancellationToken cancellationToken);
+
+ ///
+ /// Deletes a TagType by its MongoDB identifier.
+ ///
+ /// The TagType MongoDB identifier.
+ /// A representing
+ /// the asynchronous execution of the service.
+ ValueTask DeleteTagType(string tagTypeId, CancellationToken cancellationToken);
}
}
diff --git a/Core.Inventory.Provider/Providers/Inventory/TagOverrideProvider.cs b/Core.Inventory.Provider/Providers/Inventory/TagOverrideProvider.cs
index f142653..b9875c3 100644
--- a/Core.Inventory.Provider/Providers/Inventory/TagOverrideProvider.cs
+++ b/Core.Inventory.Provider/Providers/Inventory/TagOverrideProvider.cs
@@ -145,5 +145,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
return entity;
}
+
+ ///
+ /// Deletes a TagOverride by its MongoDB identifier.
+ ///
+ /// The TagOverride MongoDB identifier.
+ /// A representing
+ /// the asynchronous execution of the service.
+ public async ValueTask DeleteTagOverride(string tagOverrideId, CancellationToken cancellationToken)
+ {
+ try
+ {
+ var entity = await repository.DeleteOneAsync(doc => doc._Id == tagOverrideId);
+ return entity;
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/Core.Inventory.Provider/Providers/Inventory/TagProvider.cs b/Core.Inventory.Provider/Providers/Inventory/TagProvider.cs
index fd8faa6..fbc067d 100644
--- a/Core.Inventory.Provider/Providers/Inventory/TagProvider.cs
+++ b/Core.Inventory.Provider/Providers/Inventory/TagProvider.cs
@@ -188,5 +188,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
return tag;
}
+
+ ///
+ /// Deletes a Tag by its MongoDB identifier.
+ ///
+ /// The Tag MongoDB identifier.
+ /// A representing
+ /// the asynchronous execution of the service.
+ public async ValueTask DeleteTag(string tagId, CancellationToken cancellationToken)
+ {
+ try
+ {
+ var entity = await repository.DeleteOneAsync(doc => doc._Id == tagId);
+ return entity;
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ }
}
}
diff --git a/Core.Inventory.Provider/Providers/Inventory/TagTypeProvider.cs b/Core.Inventory.Provider/Providers/Inventory/TagTypeProvider.cs
index 2d765b5..4776e44 100644
--- a/Core.Inventory.Provider/Providers/Inventory/TagTypeProvider.cs
+++ b/Core.Inventory.Provider/Providers/Inventory/TagTypeProvider.cs
@@ -7,6 +7,7 @@ using Core.Inventory.Provider.Contracts;
using Mapster;
using Microsoft.Extensions.Options;
using MongoDB.Driver;
+using System.Security.Cryptography;
namespace Core.Inventory.Provider.Providers.Inventory
{
@@ -145,5 +146,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
return entity;
}
+
+ ///
+ /// Deletes a TagType by its MongoDB identifier.
+ ///
+ /// The TagType MongoDB identifier.
+ /// A representing
+ /// the asynchronous execution of the service.
+ public async ValueTask DeleteTagType(string tagTypeId, CancellationToken cancellationToken)
+ {
+ try
+ {
+ var entity = await repository.DeleteOneAsync(doc => doc._Id == tagTypeId);
+ return entity;
+ }
+ catch (Exception)
+ {
+ throw;
+ }
+ }
}
}