Added new endpoint for variants GetAll
This commit is contained in:
		| @@ -0,0 +1,14 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="GetAllFurnitureVariantRequest.cs"> | ||||
| //     Core.Inventory | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
| using Lib.Architecture.BuildingBlocks; | ||||
|  | ||||
| namespace Core.Inventory.Application.UseCases.Inventory.Input.Variant | ||||
| { | ||||
|     public class GetAllFurnitureVariantRequest : ICommand | ||||
|     { | ||||
|         public bool Validate() => true; | ||||
|     } | ||||
| } | ||||
| @@ -23,7 +23,8 @@ namespace Core.Inventory.Application.UseCases.Inventory | ||||
|         IComponentHandler<GetFurnitureVariantByIdRequest>, | ||||
|         IComponentHandler<GetAllFurnitureVariantsByModelIdRequest>, | ||||
|         IComponentHandler<ChangeFurnitureVariantStatusRequest>, | ||||
|         IComponentHandler<GetFurnitureVariantsByIdsRequest> | ||||
|         IComponentHandler<GetFurnitureVariantsByIdsRequest>, | ||||
|         IComponentHandler<GetAllFurnitureVariantRequest> | ||||
|     { | ||||
|         // FurnitureBase | ||||
|         private readonly IFurnitureBasePort _basePort; | ||||
| @@ -315,7 +316,7 @@ namespace Core.Inventory.Application.UseCases.Inventory | ||||
|                     return; | ||||
|                 } | ||||
|  | ||||
|                 var result = await _inventoryDALService.GetFurnitureVariantsByIdsAsync(command.Ids.ToArray()); | ||||
|                 var result = await _inventoryDALService.GetFurnitureVariantsByIdsAsync([.. command.Ids], cancellationToken); | ||||
|  | ||||
|                 if (result is null || !result.Any()) | ||||
|                 { | ||||
| @@ -350,6 +351,24 @@ namespace Core.Inventory.Application.UseCases.Inventory | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         public async ValueTask ExecuteAsync(GetAllFurnitureVariantRequest command, CancellationToken cancellationToken = default) | ||||
|         { | ||||
|             try | ||||
|             { | ||||
|                 var result = await _inventoryDALService.GetAllFurnitureVariantAsync(cancellationToken); | ||||
|                 if (!result.Any()) | ||||
|                 { | ||||
|                     _variantPort.NoContentSuccess(); | ||||
|                     return; | ||||
|                 } | ||||
|                 _variantPort.Success([.. result]); | ||||
|             } | ||||
|             catch (Exception ex) | ||||
|             { | ||||
|                 ApiResponseHelper.EvaluatePort(ex, _basePort); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         #endregion | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user