[t-010] Create GraphQL Query.page resolver + integrate with app_data #10

Open
opened 2026-07-05 08:31:00 +00:00 by david · 0 comments
Owner

Goal

Add Query.page(id: ID!, sessionId: ID) to the GraphQL schema and wire it into the app_data HTTP endpoint.

References

Reference

  • DESIGN.md §4 GraphQL Schema (Query.page)
  • AGENT.md §9 GraphQL Schema Rules

Implementation Steps

Implementation Steps

1. Update src/models/graphql.py

Add Query.page resolver:

# src/models/graphql.py (append to existing file)
@strawberry.type
class Query:
    @strawberry.field
    async def page(self, id: str, session_id: Optional[str] = None) -> dict:
        if id == "sessions":
            from src.services.hermes_client import HermesClient
            from src.services.page_builder import build_sessions_page
            client = HermesClient()
            sessions = await client.list_sessions()
            return build_sessions_page(sessions)
        # Other page IDs handled in later tasks
        return {
            "page": {"id": id, "header": None, "items": [], "footer": None},
        }

2. Update src/routes/app_data.py to also expose GraphQL page query via /graphql endpoint

The GraphQL mount already handles this — no additional route code needed.

Verification Gate

Verification Gate

Run:

cd /home/david/Projects/keryx-bff && uv run python -c "
from src.models.graphql import schema
result = schema.execute_sync('{ page(id: \"sessions\") { id header { title } items { __typename } footer } }')
data = result.data['page']
assert data['id'] == 'sessions'
print('OK')"
# Expected output: OK (may have empty items if Hermes is not running — that's fine)

STOP Conditions

STOP Conditions

  • If the GraphQL query returns an error instead of data, stop and debug the resolver.

Depends on: t-009

## Goal Add `Query.page(id: ID!, sessionId: ID)` to the GraphQL schema and wire it into the app_data HTTP endpoint. ## References ## Reference - DESIGN.md §4 GraphQL Schema (Query.page) - AGENT.md §9 GraphQL Schema Rules ## Implementation Steps ## Implementation Steps ### 1. Update `src/models/graphql.py` Add Query.page resolver: ```python # src/models/graphql.py (append to existing file) @strawberry.type class Query: @strawberry.field async def page(self, id: str, session_id: Optional[str] = None) -> dict: if id == "sessions": from src.services.hermes_client import HermesClient from src.services.page_builder import build_sessions_page client = HermesClient() sessions = await client.list_sessions() return build_sessions_page(sessions) # Other page IDs handled in later tasks return { "page": {"id": id, "header": None, "items": [], "footer": None}, } ``` ### 2. Update `src/routes/app_data.py` to also expose GraphQL page query via /graphql endpoint The GraphQL mount already handles this — no additional route code needed. ## Verification Gate ## Verification Gate Run: ```bash cd /home/david/Projects/keryx-bff && uv run python -c " from src.models.graphql import schema result = schema.execute_sync('{ page(id: \"sessions\") { id header { title } items { __typename } footer } }') data = result.data['page'] assert data['id'] == 'sessions' print('OK')" # Expected output: OK (may have empty items if Hermes is not running — that's fine) ``` ## STOP Conditions ## STOP Conditions - If the GraphQL query returns an error instead of data, stop and debug the resolver. Depends on: t-009
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: david/keryx-bff#10
No description provided.