feat: add querying and filtering (STIT-403,STIT-404)#52
Draft
feat: add querying and filtering (STIT-403,STIT-404)#52
Conversation
Unit tests with mocked query() are sufficient for router layer; db action tests cover the actual pagination logic with real data.
- Routers construct DBQuery via pagination_to_db() - ORM classmethods use TYPE_CHECKING import for DBQuery - Fix lint issues from local imports - Update router test assertions for new calling convention
- Cut 12 tests: dataclass constructor/default tests, Pydantic validation tests, and action function wrapper tests redundant with execute_query - Parametrize ResourceModel.execute_query with seed fixture + test cases - Seed fixtures for both models reduce setup duplication and make adding sorting/filtering test cases straightforward
… use composed Pydantic models
…ssmethods - New OGFieldQueryMixin declarative mixin owns shared OG field columns and async query/count classmethods (query, count, _base_query, _build_conditions, _apply_sort, _apply_pagination) - ResourceCoalescedView inherits mixin, gets query for free - OilGasFieldSourceModel inherits mixin, overrides _base_query to add membership join + ACTIVE filter - Consolidate OGFieldResourceQueryParams/OGFieldSourceQueryParams into single OGFieldQueryParams - Delete db/query.py — logic now lives in the mixin - Actions modules become thin orchestrators delegating to mixin classmethods
…embership module - Use PEP 695 inline TypeVar [QM: OGFieldQueryMixin] on Select-returning classmethods so parent and child share the same generic signature, resolving Select invariance issue without type: ignore - Extract MembershipModel/MembershipStatus into membership.py to break circular import between oil_gas_field_source.py and resource.py - Change MembershipModel.create() to accept resource_id: int instead of resource: ResourceModel, eliminating the bidirectional dependency
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.
No description provided.