Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/danielsl4/TFG_DAM_2526/llms.txt

Use this file to discover all available pages before exploring further.

The porra (match predictor) lets you guess the outcome of upcoming matches before they kick off. Every correct prediction earns you one point, and your total score determines your position on the global leaderboard. It is a fun way to test your futsal knowledge and compete against other fans.

How the porra works

Before a match begins, you choose one of three outcomes:
  • local — the home team wins
  • empate — the match ends in a draw
  • visitante — the away team wins
When the match is marked as finished, the system automatically checks every prediction against the real result and awards one point to anyone who guessed correctly.
You can only vote on matches with a pendiente (pending) status where both the home and away teams are already confirmed. Placeholder slots (“TBD”) cannot be voted on yet.

Submitting a vote

Send a POST request to /matches/:id/vote with your chosen outcome in the request body. You must be authenticated.
curl -X POST https://your-api/matches/17/vote \
  -H "Authorization: Bearer <your-token>" \
  -H "Content-Type: application/json" \
  -d '{ "vote": "local" }'
A successful vote returns the updated vote counts for the match:
{
  "message": "Voto registrado correctamente",
  "votingStats": {
    "local": 12,
    "draw": 5,
    "away": 8,
    "total": 25
  }
}

Changing your vote

You can change your prediction at any time before the match starts. Simply call the same endpoint again with a different value. The API uses an upsert — your previous vote is replaced automatically.
curl -X POST https://your-api/matches/17/vote \
  -H "Authorization: Bearer <your-token>" \
  -H "Content-Type: application/json" \
  -d '{ "vote": "empate" }'
Keep an eye on the voting stats to see how the community is leaning. It may or may not help you decide!

Viewing voting statistics

Each match response includes a votingStats object showing how votes are distributed:
{
  "votingStats": {
    "local": 12,
    "draw": 5,
    "away": 8,
    "total": 25
  }
}
If you are authenticated, the match response also includes a userVote field showing your current prediction ("local", "empate", "visitante", or null if you have not voted yet).

Points and ranking

1

Vote before the match starts

Submit your prediction while the match status is pendiente.
2

Wait for the result

Once a referee or admin marks the match as finished and enters the final score, the system evaluates all predictions automatically.
3

Earn a point for a correct guess

If your prediction matches the actual result, one point is added to your account. Incorrect guesses earn no points.
4

Check your rank

Your updated total and global ranking are visible on your profile and in the leaderboard.

Checking the leaderboard

The top 10 users by points are available without logging in:
curl https://your-api/statistics/user-ranking
[
  { "id": 7,  "username": "carlos_pro", "points": 23 },
  { "id": 42, "username": "maria_gol",  "points": 19 },
  { "id": 3,  "username": "futsal_fan", "points": 17 }
]

Checking your personal stats

To see your own points, global rank, and your last 20 predictions, call the personal stats endpoint. This requires authentication.
curl https://your-api/statistics/user-stats \
  -H "Authorization: Bearer <your-token>"
{
  "totalPoints": 19,
  "globalRank": 2,
  "history": [
    {
      "my_prediction": "local",
      "points_awarded": 1,
      "match_id": 17,
      "home_goals": 3,
      "away_goals": 1,
      "status": "finalizado",
      "home_team_name": "FC Rápidos",
      "away_team_name": "Deportivo Sur",
      "real_result": "local"
    },
    {
      "my_prediction": "empate",
      "points_awarded": 0,
      "match_id": 14,
      "home_goals": 2,
      "away_goals": 4,
      "status": "finalizado",
      "home_team_name": "Norte United",
      "away_team_name": "FC Rápidos",
      "real_result": "visitante"
    }
  ]
}
The history array contains up to 20 entries, ordered by match date descending. For pending matches, real_result is "pendiente" and points_awarded reflects what was earned once the match finishes.

Authentication

Log in and get a token before you can vote.

User profile

View your porra score and full vote history on your profile.

Build docs developers (and LLMs) love