Merge pull request 'feat: added endpoint DeleteProduct (DAL)' (#5) from feature/create-Product-and-ProductTag-CRUD(DAL) into development

Reviewed-on: #5
Reviewed-by: Sergio Matías <sergio.matias@agilewebs.com>
This commit is contained in:
2025-08-06 17:53:58 +00:00
5 changed files with 60 additions and 8 deletions

View File

@@ -202,5 +202,30 @@ namespace Core.Inventory.DAL.API.Controllers
return Ok(result);
}
/// <summary>
/// Deletes a Product by its MongoDB identifier.
/// </summary>
/// <param name="id">The Product MongoDB identifier.</param>
/// <returns>The result of the delete operation.</returns>
/// <response code="200">The Product deleted successfully.</response>
/// <response code="404">The Product not found.</response>
/// <response code="500">The service internal error.</response>
[HttpDelete]
[Route("{id}")]
[Consumes(MimeTypes.ApplicationJson)]
[Produces(MimeTypes.ApplicationJson)]
[ProducesResponseType(typeof(bool), StatusCodes.Status200OK)]
public async Task<IActionResult> DeleteProduct([FromRoute] string id, CancellationToken cancellationToken)
{
var result = await service.DeleteProduct(id, cancellationToken).ConfigureAwait(false);
if (!result)
{
return NotFound("Product not found");
}
return Ok(result);
}
}
}