From 7be64e35292b7a8b90b6d98921cd38acfc22fc82 Mon Sep 17 00:00:00 2001 From: Mikhail Trubnikov Date: Wed, 3 Apr 2024 16:07:41 +1000 Subject: [PATCH] =?UTF-8?q?feat(api):=20Application=20GetAll,=20Work=20Get?= =?UTF-8?q?All=20-=20=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D1=8B=20=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=D1=8B=20=D0=BF?= =?UTF-8?q?=D0=BE=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PARR.API/Contracts/V1/Requests/Queries/ApplicationQuery.cs | 6 ++++++ PARR.API/Contracts/V1/Requests/Queries/WorkGetAllQuery.cs | 5 +++++ PARR.API/Controllers/V1/ApplicationController.cs | 3 +++ PARR.API/Controllers/V1/WorkController.cs | 3 +++ 4 files changed, 17 insertions(+) diff --git a/PARR.API/Contracts/V1/Requests/Queries/ApplicationQuery.cs b/PARR.API/Contracts/V1/Requests/Queries/ApplicationQuery.cs index fa3d2a61..2068773b 100644 --- a/PARR.API/Contracts/V1/Requests/Queries/ApplicationQuery.cs +++ b/PARR.API/Contracts/V1/Requests/Queries/ApplicationQuery.cs @@ -14,5 +14,11 @@ namespace PARR.API.Contracts.V1.Requests.Queries /// Поиск по типу /// public Guid? TypeId { get; set; } + + + /// + /// Поиск по ИД + /// + public Guid? Id { get; set; } } } diff --git a/PARR.API/Contracts/V1/Requests/Queries/WorkGetAllQuery.cs b/PARR.API/Contracts/V1/Requests/Queries/WorkGetAllQuery.cs index e6c82d2d..53135642 100644 --- a/PARR.API/Contracts/V1/Requests/Queries/WorkGetAllQuery.cs +++ b/PARR.API/Contracts/V1/Requests/Queries/WorkGetAllQuery.cs @@ -11,5 +11,10 @@ /// Поиск по имени. Например: "прочее" /// public string? Name { get; set; } + + /// + /// Поиск по ИД + /// + public Guid? Id { get; set; } } } diff --git a/PARR.API/Controllers/V1/ApplicationController.cs b/PARR.API/Controllers/V1/ApplicationController.cs index 49ce3fa4..7838cced 100644 --- a/PARR.API/Controllers/V1/ApplicationController.cs +++ b/PARR.API/Controllers/V1/ApplicationController.cs @@ -55,6 +55,9 @@ namespace PARR.API.Controllers.V1 if (filter.TypeId.HasValue) query = query.Where(t => t.ApplicationTypeId == filter.TypeId); + if (filter.Id.HasValue) + query = query.Where(t => t.Id == filter.Id); + var apps = await applicationService.GetPage(query, paginationFilter).ToListAsync(); diff --git a/PARR.API/Controllers/V1/WorkController.cs b/PARR.API/Controllers/V1/WorkController.cs index c00e9fee..5d781b9b 100644 --- a/PARR.API/Controllers/V1/WorkController.cs +++ b/PARR.API/Controllers/V1/WorkController.cs @@ -65,6 +65,9 @@ namespace PARR.API.Controllers.V1 if (!string.IsNullOrWhiteSpace(filter.Name)) query = query.Where(t => t.Name.ToLower().Contains(filter.Name.ToLower())); + if (filter.Id.HasValue) + query = query.Where(t => t.Id == filter.Id); + var works = await workService.GetPage(query, paginationFilter).ToListAsync();