Development - #14
Merged
Merged
Conversation
Interactions are game-specific; the query previously filtered only by player_id and returned a player's rows across all games. Now it filters by both game_id and player_id so the result is scoped to one game.
ListInteractions now accepts limit and offset so clients can paginate a game's interactions. The ListRecentInteractions SQL query becomes 'LIMIT ? OFFSET ?' with an Offset field added to ListRecentInteractionsParams. The use case validates offset >= 0. To unbreak: update the remaining callers of port.DataFetching.ListInteractions to pass an offset argument - cliadapter.runFetch (cli.go), httpadapter.handleListInteractions (handlers.go), and the fakeFetch stub in httpadapter/http_test.go. Pass offset=0 for no pagination.
Fixes the breaking change in feat!(usecase): add offset to ListInteractions (fbcabe0). The CLI (cliadapter.runFetch), HTTP handler (httpadapter.handleListInteractions), and the fakeFetch test stub now pass offset=0 so the codebase compiles and tests pass again.
The fetch interactions subcommand now accepts an optional third argument for the offset (defaulting to 0), so CLI users can paginate a game's interactions. Updates the CLI usage text and README to include the new <offset> argument, and adds CLI tests for default-offset, explicit-offset, invalid-offset, and too-many-arguments.
ListPlayerInteractions now accepts limit and offset so a caller can paginate a specific player's interactions within a game. The SQL query becomes 'LIMIT ? OFFSET ?' with Limit and Offset fields added to ListPlayerInteractionsParams, and the use case validates both are >= 0. To unbreak: update the remaining callers of port.DataFetching.ListPlayerInteractions to pass limit and offset - the fakeFetch stub in httpadapter/http_test.go and the mockFetch stub in cliadapter/cli_test.go. Pass limit=~0~ with offset=0 to preserve existing behavior, or choose explicit values.
Fixes the breaking change in feat!(usecase): add limit and offset to ListPlayerInteractions (8a1f2cf). The fakeFetch stub in httpadapter/http_test.go and the mockFetch stub in cliadapter/cli_test.go now use the 5-argument ListPlayerInteractions signature so the codebase compiles and all tests pass again.
The GET /interactions handler now accepts an optional query parameter with values all|player|first|last (default all), routing to the corresponding DataFetching use case, and an optional offset parameter for pagination. Invalid query or offset values return 400. Adds unit tests (routing + validation), a regression test proving no-param behavior equals query=all, and integration tests against real use cases and an in-memory SQLite database.
Adds the query parameter (enum all|player|first|last, default all with per-value descriptions), the offset parameter (minimum 0, default 0), and documents the 200 response shapes (array for all/player, single Interaction or null for first/last). Also documents the 400 response for invalid query or offset.
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.