Add physical delete

This commit is contained in:
Oscar Morales
2025-08-08 11:12:11 -06:00
parent 97992e5cdb
commit 6146fcfed2
9 changed files with 148 additions and 0 deletions

View File

@@ -55,5 +55,13 @@ namespace Core.Inventory.Provider.Contracts
/// <returns>A <see cref="{Task{TagOverrideAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<TagOverrideAdapter> UpdateTagOverride(TagOverrideAdapter entity, CancellationToken cancellationToken);
/// <summary>
/// Deletes a TagOverride by its MongoDB identifier.
/// </summary>
/// <param name="tagOverrideId">The TagOverride MongoDB identifier.</param>
/// <returns>A <see cref="{Task{TagOverrideAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<TagOverrideAdapter> DeleteTagOverride(string tagOverrideId, CancellationToken cancellationToken);
}
}

View File

@@ -71,5 +71,13 @@ namespace Core.Inventory.Provider.Contracts
/// <param name="parentTagId">The identifier of the parentTag to add.</param>
/// <returns>A <see cref="Task{TagAdapter}"/> representing the asynchronous operation, with the updated tag object.</returns>
ValueTask<TagAdapter> RemoveParentTag(string tagId, string parentTagId, CancellationToken cancellationToken);
/// <summary>
/// Deletes a Tag by its MongoDB identifier.
/// </summary>
/// <param name="TagId">The Tag MongoDB identifier.</param>
/// <returns>A <see cref="{Task{TagAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<TagAdapter> DeleteTag(string tagId, CancellationToken cancellationToken);
}
}

View File

@@ -55,5 +55,13 @@ namespace Core.Inventory.Provider.Contracts
/// <returns>A <see cref="{Task{TagTypeAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<TagTypeAdapter> UpdateTagType(TagTypeAdapter entity, CancellationToken cancellationToken);
/// <summary>
/// Deletes a TagType by its MongoDB identifier.
/// </summary>
/// <param name="tagTypeId">The TagType MongoDB identifier.</param>
/// <returns>A <see cref="{Task{TagTypeAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
ValueTask<TagTypeAdapter> DeleteTagType(string tagTypeId, CancellationToken cancellationToken);
}
}

View File

@@ -145,5 +145,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
return entity;
}
/// <summary>
/// Deletes a TagOverride by its MongoDB identifier.
/// </summary>
/// <param name="tagOverrideId">The TagOverride MongoDB identifier.</param>
/// <returns>A <see cref="{Task{TagOverrideAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
public async ValueTask<TagOverrideAdapter> DeleteTagOverride(string tagOverrideId, CancellationToken cancellationToken)
{
try
{
var entity = await repository.DeleteOneAsync(doc => doc._Id == tagOverrideId);
return entity;
}
catch (Exception)
{
throw;
}
}
}
}

View File

@@ -188,5 +188,24 @@ namespace Core.Inventory.Provider.Providers.Inventory
return tag;
}
/// <summary>
/// Deletes a Tag by its MongoDB identifier.
/// </summary>
/// <param name="tagId">The Tag MongoDB identifier.</param>
/// <returns>A <see cref="{Task{TagAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
public async ValueTask<TagAdapter> DeleteTag(string tagId, CancellationToken cancellationToken)
{
try
{
var entity = await repository.DeleteOneAsync(doc => doc._Id == tagId);
return entity;
}
catch (Exception)
{
throw;
}
}
}
}

View File

@@ -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;
}
/// <summary>
/// Deletes a TagType by its MongoDB identifier.
/// </summary>
/// <param name="tagTypeId">The TagType MongoDB identifier.</param>
/// <returns>A <see cref="{Task{TagTypeAdapter}}"/> representing
/// the asynchronous execution of the service.</returns>
public async ValueTask<TagTypeAdapter> DeleteTagType(string tagTypeId, CancellationToken cancellationToken)
{
try
{
var entity = await repository.DeleteOneAsync(doc => doc._Id == tagTypeId);
return entity;
}
catch (Exception)
{
throw;
}
}
}
}