SylverStudios / SylverStudios.github.io

The Sylver Studios blog
https://sylverstudios.dev
1 stars 0 forks source link

TMM with scoreboard #19

Open shamshirz opened 5 years ago

shamshirz commented 5 years ago

Problem

Robbie wants to share his score and compete with Dave.

MVP needs

Does this need to be in the same place? idts. What's the easiest way to do this?

TMM

TMM asks for name, then hits the submit API. Displays a link to the leaderboard.

Leaderboard

✅ Allow random users to submit ✅ CORS for only sylverstudios.dev ✅ Return top 10 (APIs below) ✅ Heroku Elixir updated to erl 21, elixir 1.8 ⬜️ Add to TMM source? ⬜️ Prevent blowing up my bill? (phase2) (no mutations via graphIQL?)

Some way to view the Highscores

Alternative

https://github.com/SylverStudios/leaderboard-client

Small elm app, not fullscreen. Has an input view, and a top scores view. Given a game ID. So we can embed it in any page.

shamshirz commented 5 years ago

API calls

Highscores

  query HighScores($game_id: ID!) {
    game(id: $game_id) {
      name
      scores(limit: 10) {
        total
        player { name }
      }
    }
  }

Submit

  mutation NewScore($game_id: ID!, $name: String!, $total: Int!) {
    submit(game_id: $game_id, name: $name, total: $total) {
      game { name }
      player { name }
      total
    }
  }