Added new endpoint for variants GetAll
This commit is contained in:
@@ -22,16 +22,16 @@ namespace Core.Inventory.BFF.API.Controllers
|
||||
/// </summary>
|
||||
[HttpGet("GetAll")]
|
||||
[ProducesResponseType(typeof(IEnumerable<FurnitureBase>), StatusCodes.Status200OK)]
|
||||
public async Task<IActionResult> GetAllAsync(CancellationToken cancellationToken)
|
||||
public async Task<IActionResult> GetAllBaseAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
try
|
||||
{
|
||||
logger.LogInformation($"{nameof(GetAllAsync)} - Request received.");
|
||||
return await Handle(() => inventoryClient.GetAllAsync(TrackingId.ToString(), cancellationToken));
|
||||
logger.LogInformation($"{nameof(GetAllBaseAsync)} - Request received.");
|
||||
return await Handle(() => inventoryClient.GetAllBaseAsync(TrackingId.ToString(), cancellationToken));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.LogError(ex, $"{nameof(GetAllAsync)} - An error occurred.");
|
||||
logger.LogError(ex, $"{nameof(GetAllBaseAsync)} - An error occurred.");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Core.Inventory.External.Clients.Inventory
|
||||
#region Furniture Base
|
||||
|
||||
[Get("/api/v1/FurnitureBase/GetAll")]
|
||||
Task<ApiResponse<IEnumerable<FurnitureBase>>> GetAllAsync([Header("TrackingId")] string trackingId, CancellationToken cancellationToken = default);
|
||||
Task<ApiResponse<IEnumerable<FurnitureBase>>> GetAllBaseAsync([Header("TrackingId")] string trackingId, CancellationToken cancellationToken = default);
|
||||
|
||||
[Post("/api/v1/FurnitureBase/GetById")]
|
||||
Task<ApiResponse<FurnitureBase>> GetByIdAsync([Header("TrackingId")] string trackingId, [Body] GetFurnitureBaseByIdRequest request, CancellationToken cancellationToken = default);
|
||||
@@ -29,7 +29,7 @@ namespace Core.Inventory.External.Clients.Inventory
|
||||
#region Furniture Variant
|
||||
|
||||
[Post("/api/v1/FurnitureVariant/GetAllByModelId")]
|
||||
Task<ApiResponse<IEnumerable<FurnitureVariant>>> GetVariantsByModelIdAsync([Header("TrackingId")] string trackingId, [Body] GetAllFurnitureVariantsByModelIdRequest request, CancellationToken cancellationToken = default);
|
||||
Task<ApiResponse<IEnumerable<FurnitureVariant>>> GetAllVariantsByModelIdAsync([Header("TrackingId")] string trackingId, [Body] GetAllFurnitureVariantsByModelIdRequest request, CancellationToken cancellationToken = default);
|
||||
|
||||
[Post("/api/v1/FurnitureVariant/GetById")]
|
||||
Task<ApiResponse<FurnitureVariant>> GetFurnitureVariantByIdAsync([Header("TrackingId")] string trackingId, [Body] GetFurnitureVariantByIdRequest request, CancellationToken cancellationToken = default);
|
||||
@@ -46,6 +46,9 @@ namespace Core.Inventory.External.Clients.Inventory
|
||||
[Patch("/api/v1/FurnitureVariant/ChangeStatus")]
|
||||
Task<ApiResponse<FurnitureVariant>> ChangeFurnitureVariantStatusAsync([Header("TrackingId")] string trackingId, [Body] ChangeFurnitureVariantStatusRequest request, CancellationToken cancellationToken = default);
|
||||
|
||||
[Get("/api/v1/FurnitureVariant/GetAll")]
|
||||
Task<ApiResponse<IEnumerable<FurnitureVariant>>> GetAllVariantsAsync([Header("TrackingId")] string trackingId, CancellationToken cancellationToken = default);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Core.Inventory.External.Clients.Inventory.Requests.Variant
|
||||
{
|
||||
public class GetAllFurnitureVariantRequest
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user