Conversation
Add a PaginatedResponseDto (electrostoreAPI/DTO/paginatedReponseDto.cs) and update numerous controllers to return PaginatedResponseDto<T> for list GET endpoints instead of IEnumerable<T>. Removed code that set X-Total-Count headers (pagination info is now returned in the response body). Adjusted related services, interfaces, Program.cs and swagger to match the new paginated response shape.
Introduce RSQL-based filtering and sorting across the API: add filter DTO and ParserExtensions (electrostoreAPI/DTO/filterDto.cs, electrostoreAPI/Extensions/ParserExtensions.cs) and wire ParserExtensions.ParseFilter/ParseSort in controllers. Many controllers now accept optional "filter" and "sort" query parameters (with Swagger descriptions) and pass parsed RSQL/sort DTOs to service methods. Corresponding service method signatures were updated to accept these parsed filter/sort DTOs. This enables standardized client-side filtering and ordering for list endpoints.
Introduce RsqlParserExtensions to convert RSQL-like FilterDto/SorterDto into LINQ expressions for filtering and sorting. inject generated filter expressions, apply dynamic ordering when sort provided, and fall back to sensible default orderings.
Extend RsqlParserExtensions to support nested property access and collection filtering. Update ToFilterExpression usage across many services: destructure the returned tuple into filterResult and rsql, apply the filter to queries, and use null-coalescing predicates for CountAsync/AnyAsync to ensure totals/hasMore respect filters. Add required System.Linq.Expressions imports. Remove multiple controller/service test files and adjust ProgramTests accordingly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates several controller endpoints to support advanced filtering and sorting for paginated GET requests. It introduces RSQL-based filtering and sorting parameters, standardizes paginated responses, and simplifies the handling of total count headers. These changes enhance the flexibility and consistency of the API for clients.
Added support for RSQL-based filtering and sorting via new
filterandsortquery parameters in the GET endpointsThe controllers now use
ParserExtensions.ParseFilterandParserExtensions.ParseSortto process these parameters.Updated the return types of relevant GET endpoints to use
PaginatedResponseDto<T>instead of a simpleIEnumerable<T>, standardizing paginated responses across controllers.Removed manual setting of
X-Total-Countheaders and related code from controllers, as the new paginated response DTOs encapsulate pagination metadata.