Skip to content
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

Backend Tournaments #397

Merged
merged 4 commits into from
Dec 16, 2024
Merged

Backend Tournaments #397

merged 4 commits into from
Dec 16, 2024

Conversation

sonerkuyar
Copy link
Member

Add Tournament and PGN Fetching Endpoints

Description

This PR introduces three new endpoints to enhance the chess tournament features of the application. These endpoints allow fetching tournament details, round-specific information, and PGN (Portable Game Notation) data for games in a specific round. The functionality integrates with the Lichess Broadcast API to retrieve real-time chess tournament data.

Endpoints

1. Get Current Tournaments

  • Path: tournaments/
  • Function: get_current_tournaments
  • Description:
    • Fetches the list of currently ongoing tournaments.
    • Provides essential metadata such as tournament name, description, start and end times, and tier.
    • Utilizes the Lichess API to fetch the live tournament details.

2. Get Tournament Round Details

  • Path: tournaments/<str:tournamentSlug>/<str:roundSlug>/<str:roundId>/
  • Function: get_tournament_round
  • Description:
    • Fetches detailed information about a specific tournament round.
    • Includes metadata such as round ID, round name, participating players, and live URLs for games.
    • Maps games using player names and integrates group or tournament-level details.

3. Get PGNs for a Tournament Round

  • Path: tournament/round/<str:roundId>/pgn/
  • Function: get_tournament_round_pgn
  • Description:
    • Fetches the PGN representation of all games in a specific tournament round.
    • Maps PGNs to human-readable keys in the format: WhitePlayer - BlackPlayer.
    • Captures headers and moves from the Lichess PGN API for detailed game reconstruction.

Testing

  • Ensured PGN parsing is accurate and includes all headers and moves.
  • Verified API responses for valid and invalid inputs (e.g., missing round IDs or invalid tournament slugs).
  • Tested integration with Lichess API under various conditions (e.g., no ongoing tournaments).

- Created endpoint for returning current torunaments, their websites, images and other information
- Documentation tested on Swagger UI
- Add endpoints for fetching current tournaments, detailed tournament round info, and PGNs by round ID.
- Documented and tried via Swagger UI
- Unit Tests for tournament endpoints has been created
@sonerkuyar sonerkuyar added the Component: Backend Issues related to server-side logic or infrastructure label Dec 16, 2024
@sonerkuyar sonerkuyar added this to the Milestone 3 - (Final) milestone Dec 16, 2024
@sonerkuyar sonerkuyar self-assigned this Dec 16, 2024
@yusufaygun
Copy link
Contributor

Reviewed the PR, the implementation looks solid with well-documented endpoints and thorough testing. However, I noticed that the PR is opened against the main branch. Was this intentional, or should it be directed to the backend branch instead? If you can confirm the target branch, than it can be merged everything looks good.

@sonerkuyar sonerkuyar changed the base branch from main to backend December 16, 2024 10:27
@sonerkuyar
Copy link
Member Author

Reviewed the PR, the implementation looks solid with well-documented endpoints and thorough testing. However, I noticed that the PR is opened against the main branch. Was this intentional, or should it be directed to the backend branch instead? If you can confirm the target branch, than it can be merged everything looks good.

It's my mistake. Fixed now!

@yusufaygun
Copy link
Contributor

OK, thanks. Now I am merging.

@yusufaygun yusufaygun merged commit 1e558d5 into backend Dec 16, 2024
@sonerkuyar sonerkuyar linked an issue Dec 16, 2024 that may be closed by this pull request
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Backend Issues related to server-side logic or infrastructure
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend: Create Tournaments Endpoints
2 participants