Added new endpoint for variants GetAll

This commit is contained in:
2025-06-27 18:11:21 -06:00
parent 3e8100e1c5
commit 15d0d24313
4 changed files with 35 additions and 7 deletions

View File

@@ -17,6 +17,25 @@ namespace Core.Inventory.BFF.API.Controllers
[Produces("application/json")]
public class FurnitureVariantController(IInventoryServiceClient inventoryClient, ILogger<FurnitureVariantController> logger) : BaseController(logger)
{
/// <summary>
/// Gets all furniture base records.
/// </summary>
[HttpGet("GetAll")]
[ProducesResponseType(typeof(IEnumerable<FurnitureVariant>), StatusCodes.Status200OK)]
public async Task<IActionResult> GetAllVariantsAsync(CancellationToken cancellationToken)
{
try
{
logger.LogInformation($"{nameof(GetAllVariantsAsync)} - Request received.");
return await Handle(() => inventoryClient.GetAllVariantsAsync(TrackingId.ToString(), cancellationToken));
}
catch (Exception ex)
{
logger.LogError(ex, $"{nameof(GetAllVariantsAsync)} - An error occurred.");
throw;
}
}
/// <summary>
/// Gets furniture variants by model ID.
/// </summary>
@@ -30,7 +49,7 @@ namespace Core.Inventory.BFF.API.Controllers
if (string.IsNullOrWhiteSpace(request.ModelId)) return BadRequest("ModelId is required.");
return await Handle(() => inventoryClient.GetVariantsByModelIdAsync(TrackingId.ToString(), request, cancellationToken));
return await Handle(() => inventoryClient.GetAllVariantsByModelIdAsync(TrackingId.ToString(), request, cancellationToken));
}
catch (Exception ex)
{