diff --git a/Core.Inventory.BFF.API/Controllers/FurnitureBaseController.cs b/Core.Inventory.BFF.API/Controllers/FurnitureBaseController.cs index 472a4a3..72af896 100644 --- a/Core.Inventory.BFF.API/Controllers/FurnitureBaseController.cs +++ b/Core.Inventory.BFF.API/Controllers/FurnitureBaseController.cs @@ -22,16 +22,16 @@ namespace Core.Inventory.BFF.API.Controllers /// [HttpGet("GetAll")] [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] - public async Task GetAllAsync(CancellationToken cancellationToken) + public async Task 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; } } diff --git a/Core.Inventory.BFF.API/Controllers/FurnitureVariantController.cs b/Core.Inventory.BFF.API/Controllers/FurnitureVariantController.cs index e7d8a80..862b88c 100644 --- a/Core.Inventory.BFF.API/Controllers/FurnitureVariantController.cs +++ b/Core.Inventory.BFF.API/Controllers/FurnitureVariantController.cs @@ -17,6 +17,25 @@ namespace Core.Inventory.BFF.API.Controllers [Produces("application/json")] public class FurnitureVariantController(IInventoryServiceClient inventoryClient, ILogger logger) : BaseController(logger) { + /// + /// Gets all furniture base records. + /// + [HttpGet("GetAll")] + [ProducesResponseType(typeof(IEnumerable), StatusCodes.Status200OK)] + public async Task 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; + } + } + /// /// Gets furniture variants by model ID. /// @@ -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) { diff --git a/Core.Inventory.External/Clients/Inventory/IInventoryServiceClient.cs b/Core.Inventory.External/Clients/Inventory/IInventoryServiceClient.cs index c57f073..50529cc 100644 --- a/Core.Inventory.External/Clients/Inventory/IInventoryServiceClient.cs +++ b/Core.Inventory.External/Clients/Inventory/IInventoryServiceClient.cs @@ -10,7 +10,7 @@ namespace Core.Inventory.External.Clients.Inventory #region Furniture Base [Get("/api/v1/FurnitureBase/GetAll")] - Task>> GetAllAsync([Header("TrackingId")] string trackingId, CancellationToken cancellationToken = default); + Task>> GetAllBaseAsync([Header("TrackingId")] string trackingId, CancellationToken cancellationToken = default); [Post("/api/v1/FurnitureBase/GetById")] Task> 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>> GetVariantsByModelIdAsync([Header("TrackingId")] string trackingId, [Body] GetAllFurnitureVariantsByModelIdRequest request, CancellationToken cancellationToken = default); + Task>> GetAllVariantsByModelIdAsync([Header("TrackingId")] string trackingId, [Body] GetAllFurnitureVariantsByModelIdRequest request, CancellationToken cancellationToken = default); [Post("/api/v1/FurnitureVariant/GetById")] Task> 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> ChangeFurnitureVariantStatusAsync([Header("TrackingId")] string trackingId, [Body] ChangeFurnitureVariantStatusRequest request, CancellationToken cancellationToken = default); + [Get("/api/v1/FurnitureVariant/GetAll")] + Task>> GetAllVariantsAsync([Header("TrackingId")] string trackingId, CancellationToken cancellationToken = default); + #endregion } } diff --git a/Core.Inventory.External/Clients/Inventory/Requests/Variant/GetAllFurnitureVariantRequest.cs b/Core.Inventory.External/Clients/Inventory/Requests/Variant/GetAllFurnitureVariantRequest.cs new file mode 100644 index 0000000..a1461ba --- /dev/null +++ b/Core.Inventory.External/Clients/Inventory/Requests/Variant/GetAllFurnitureVariantRequest.cs @@ -0,0 +1,6 @@ +namespace Core.Inventory.External.Clients.Inventory.Requests.Variant +{ + public class GetAllFurnitureVariantRequest + { + } +}