diff options
Diffstat (limited to 'code/api')
| -rw-r--r-- | code/api/src/Endpoints/V1/Projects/GetProjectsRoute.cs | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/code/api/src/Endpoints/V1/Projects/GetProjectsRoute.cs b/code/api/src/Endpoints/V1/Projects/GetProjectsRoute.cs index d60f974..8fe70a6 100644 --- a/code/api/src/Endpoints/V1/Projects/GetProjectsRoute.cs +++ b/code/api/src/Endpoints/V1/Projects/GetProjectsRoute.cs @@ -13,9 +13,9 @@ public class GetProjectsRoute : RouteBaseAsync.WithRequest<GetProjectsQueryParam } [HttpGet("~/v{version:apiVersion}/projects")] - public override async Task<ActionResult<KeysetPaginationResult<GetProjectsResponseDto>>> HandleAsync(GetProjectsQueryParameters request, CancellationToken cancellationToken = default) { + public override async Task<ActionResult<KeysetPaginationResult<GetProjectsResponseDto>>> HandleAsync([FromQuery] GetProjectsQueryParameters request, CancellationToken cancellationToken = default) { var result = await _pagination.KeysetPaginateAsync( - _database.Projects.ForTenant(LoggedInUser), + _database.Projects.ForTenant(LoggedInUser).ConditionalWhere(() => request.NameQuery.HasValue(), p => p.Name.Contains(request.NameQuery)), b => b.Descending(x => x.CreatedAt), async id => await _database.Projects.FindAsync(id), query => query.Select(p => new GetProjectsResponseDto() { @@ -35,9 +35,6 @@ public class GetProjectsResponseDto public class GetProjectsQueryParameters { - [FromQuery] - public int Page { get; set; } - - [FromQuery] - public int Size { get; set; } + [FromQuery(Name = "name")] + public string NameQuery { get; set; } }
\ No newline at end of file |
