-
Notifications
You must be signed in to change notification settings - Fork 715
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: allow to query only active games #735
Comments
Yes, this would be nice. There are some things that are relatively easy to add like filtering out completed matches by checking the metadata’s Ideally, this would also be implemented in the Storage API as most backends would probably support filtering entries more efficiently than looping over the full list on the server. |
I think it would make sense anyway to add timestamps like |
We can add additional fields to the metadata during the game creation process here: And update the type here: In terms of filtering, it should be possible to add this without breaking other storage implementations if we do it by adding to the options object passed to Implementations that haven’t been updated will simply return all games instead of filtering, which is probably OK until they can be updated. (This is actually already the case with the bundled Would you be interested in trying to make this work? If possible, it would be best to base your work on the |
What do you think how the query options should look like? And how extensive should they be? export interface ListGamesOpts {
gameName?: string;
where?: {
gameover?: boolean; // true -> only finished games, false -> only unfinished games, undefined -> all games
createdBefore?: number; // timestamps
createdAfter?: number;
updatedBefore?: number;
updatedAfter?: number;
gameoverBefore?: number;
gameoverAfter?: number;
}
} |
I can see Thinking about practical uses, the most obvious ones seem to be the |
You're right, it shouldn't get too complicated. Also after having another thought, I'd say we don't need at |
Yes, that sounds good to me. |
Closed in #740 |
Currently, the
GET /games/:game
API endpoint lists all existing games. It includes also games that are already finished and also outdated games that were started days ago but never finished.It would be nice to allow handing query parameters to the endpoint to only receive active / recent games.
I know this filtering could be done on the client but this doesn't resolve the issue that with every new game, this response is getting bigger and bigger.
The text was updated successfully, but these errors were encountered: