From 399393fd555ae2ab28b82ac7391d79ee0535b729 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Tue, 24 Oct 2023 11:15:27 +0500 Subject: [PATCH] =?UTF-8?q?fix=20WellboreService;=20=D0=BF=D0=BB=D0=B0?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D1=8B=D0=B5=20=D1=81=D0=B5=D0=BA=D1=86=D0=B8?= =?UTF-8?q?=D0=B8=20=D0=BD=D0=B5=20=D1=83=D1=87=D0=B8=D1=82=D1=8B=D0=B2?= =?UTF-8?q?=D0=B0=D1=8E=D1=82=D1=81=D1=8F.=20WellboreServiceTest=20Add=20t?= =?UTF-8?q?estCase;=20Add=20Auth.http;=20Fix=20wellbore.http;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudInfrastructure/Services/WellboreService.cs | 1 + .../ServicesTests/WellboreServiceTest.cs | 4 +++- AsbCloudWebApi/Rest/Auth.http | 12 ++++++++++++ AsbCloudWebApi/Rest/wellbore.http | 8 +++----- 4 files changed, 19 insertions(+), 6 deletions(-) create mode 100644 AsbCloudWebApi/Rest/Auth.http diff --git a/AsbCloudInfrastructure/Services/WellboreService.cs b/AsbCloudInfrastructure/Services/WellboreService.cs index a0073128..4417dd49 100644 --- a/AsbCloudInfrastructure/Services/WellboreService.cs +++ b/AsbCloudInfrastructure/Services/WellboreService.cs @@ -36,6 +36,7 @@ public class WellboreService : IWellboreService var rowSections = await wellOperationRepository.GetSectionsAsync(idsWells, token); var groupedSections = rowSections + .Where(section => section.IdType == 1) .GroupBy(s => s.IdWell); var wellbores = wells diff --git a/AsbCloudWebApi.Tests/ServicesTests/WellboreServiceTest.cs b/AsbCloudWebApi.Tests/ServicesTests/WellboreServiceTest.cs index 985a7e6f..1a802054 100644 --- a/AsbCloudWebApi.Tests/ServicesTests/WellboreServiceTest.cs +++ b/AsbCloudWebApi.Tests/ServicesTests/WellboreServiceTest.cs @@ -106,9 +106,11 @@ namespace AsbCloudWebApi.Tests.ServicesTests { IdWell = well1.Id, IdWellSectionType = 0, IdType = 1, DateStart = new DateTime(2023, 01, 03), DateEnd = new DateTime(2023, 01, 04), DepthStart = 200, DepthEnd = 210 }; var section3 = new SectionByOperationsDto() { IdWell = int.MaxValue, IdWellSectionType = 0, IdType = 1, DateStart = new DateTime(2023, 01, 03), DateEnd = new DateTime(2023, 01, 04), DepthStart = 200, DepthEnd = 220 }; + var section4 = new SectionByOperationsDto() + { IdWell = well1.Id, IdWellSectionType = 0, IdType = 0, DateStart = new DateTime(2023, 01, 05), DateEnd = new DateTime(2023, 01, 06), DepthStart = 150, DepthEnd = 220 }; wellOperationRepository.GetSectionsAsync(Arg.Any>(), Arg.Any()) - .Returns(new SectionByOperationsDto[]{section0, section1, section2, section3 }); + .Returns(new SectionByOperationsDto[]{section0, section1, section2, section3, section4, }); var result = await wellboreService.GetWellboresAsync(new[] { 1 }, CancellationToken.None); diff --git a/AsbCloudWebApi/Rest/Auth.http b/AsbCloudWebApi/Rest/Auth.http new file mode 100644 index 00000000..36097c0e --- /dev/null +++ b/AsbCloudWebApi/Rest/Auth.http @@ -0,0 +1,12 @@ +@baseUrl = http://127.0.0.1:5000 +@contentType = application/json + +## Auth +POST {{baseUrl}}/auth/login +Content-Type: {{contentType}} +accept: */* + +{ + "login": "dev", + "password": "Rp7gsNMk" +} \ No newline at end of file diff --git a/AsbCloudWebApi/Rest/wellbore.http b/AsbCloudWebApi/Rest/wellbore.http index 9a7918ac..e00c6687 100644 --- a/AsbCloudWebApi/Rest/wellbore.http +++ b/AsbCloudWebApi/Rest/wellbore.http @@ -1,15 +1,13 @@ @baseUrl = http://127.0.0.1:5000 @contentType = application/json -@auth = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCIsImN0eSI6IkpXVCJ9.eyJpZCI6IjEiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiZGV2IiwiaWRDb21wYW55IjoiMSIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InJvb3QiLCJuYmYiOjE2NjI1NDgxNjIsImV4cCI6MTY5NDEwNTc2MiwiaXNzIjoiYSIsImF1ZCI6ImEifQ.OEAlNzxi7Jat6pzDBTAjTbChskc-tdJthJexyWwwUKE +@auth = Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjEiLCJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9uYW1lIjoiZGV2IiwiaWRDb21wYW55IjoiMSIsImh0dHA6Ly9zY2hlbWFzLm1pY3Jvc29mdC5jb20vd3MvMjAwOC8wNi9pZGVudGl0eS9jbGFpbXMvcm9sZSI6InJvb3QiLCJuYmYiOjE2OTgxMjY1MTUsImV4cCI6MTcyOTY4NDExNSwiaXNzIjoiYSIsImF1ZCI6ImEifQ.3Lq256cYtHnKlGWChPhZv2rUJPjbJEHU-18xdyJlYDE -@uid = 20210101_000000000 -@idCluster = 1 -@idWell = 1 +@idWell = 2 # https://marketplace.visualstudio.com/items?itemName=humao.rest-client ### -GET {{baseUrl}}/api/well/wellbore?ids=1,2 +GET {{baseUrl}}/api/wellbore?idsWells=1 Content-Type: {{contentType}} accept: */* Authorization: {{auth}}