From a0856fad25d114b853460eb5a17ae937c0276759 Mon Sep 17 00:00:00 2001 From: KharchenkoVV Date: Mon, 23 Aug 2021 16:59:26 +0500 Subject: [PATCH] CS2-66: Added well depth filter to .GetOperationsAsync() --- AsbCloudApp/Services/IWellOperationService.cs | 2 ++ AsbCloudInfrastructure/Services/WellOperationService.cs | 8 ++++++++ AsbCloudWebApi/Controllers/WellOperationController.cs | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/AsbCloudApp/Services/IWellOperationService.cs b/AsbCloudApp/Services/IWellOperationService.cs index d9f08b59..37be7c0e 100644 --- a/AsbCloudApp/Services/IWellOperationService.cs +++ b/AsbCloudApp/Services/IWellOperationService.cs @@ -17,6 +17,8 @@ namespace AsbCloudApp.Services IEnumerable operationCategoryIds = null, DateTime begin = default, DateTime end = default, + double minDepth = double.MinValue, + double maxDepth = double.MaxValue, int skip = 0, int take = 32, CancellationToken token = default); diff --git a/AsbCloudInfrastructure/Services/WellOperationService.cs b/AsbCloudInfrastructure/Services/WellOperationService.cs index 910cb9b9..8dbabeb7 100644 --- a/AsbCloudInfrastructure/Services/WellOperationService.cs +++ b/AsbCloudInfrastructure/Services/WellOperationService.cs @@ -38,6 +38,8 @@ namespace AsbCloudInfrastructure.Services IEnumerable operationCategoryIds = default, DateTime begin = default, DateTime end = default, + double minDepth = double.MinValue, + double maxDepth = double.MaxValue, int skip = 0, int take = 32, CancellationToken token = default) @@ -56,6 +58,12 @@ namespace AsbCloudInfrastructure.Services if (operationCategoryIds != default && operationCategoryIds.Any()) query = query.Where(e => operationCategoryIds.Contains(e.IdCategory)); + if (minDepth != double.MinValue) + query = query.Where(e => e.WellDepth >= minDepth); + + if (maxDepth != double.MaxValue) + query = query.Where(e => e.WellDepth <= maxDepth); + if (begin != default) query = query.Where(e => e.StartDate >= begin); diff --git a/AsbCloudWebApi/Controllers/WellOperationController.cs b/AsbCloudWebApi/Controllers/WellOperationController.cs index 838801af..2c606631 100644 --- a/AsbCloudWebApi/Controllers/WellOperationController.cs +++ b/AsbCloudWebApi/Controllers/WellOperationController.cs @@ -48,6 +48,8 @@ namespace AsbCloudWebApi.Controllers /// фильтр по списку id категорий операции /// фильтр по началу операции /// фильтр по окончанию операции + /// фильтр по минимальной глубине скважины + /// фильтр по максимальной глубине скважины /// /// /// @@ -61,6 +63,8 @@ namespace AsbCloudWebApi.Controllers [FromQuery] IEnumerable operationCategoryIds = default, DateTime begin = default, DateTime end = default, + double minDepth = double.MinValue, + double maxDepth = double.MaxValue, int skip = 0, int take = 32, CancellationToken token = default) @@ -75,6 +79,8 @@ namespace AsbCloudWebApi.Controllers operationCategoryIds, begin, end, + minDepth, + maxDepth, skip, take, token)