/android-quizz

A quizz application for android made with Java and Symfony for the API.

Primary LanguagePHP

QUIZZ

Description

Quizz is a mobile application. It allow you to play against other online player.

Database

alt text

This schema has been updated on 02/12/2018.

Technologies

Symfony3.4 : API Rest backend ; use Doctrine 2 Android release "5<"

REST API

GET /user?user=lucas : get the User object wich have lucas as username

[
    {
        "id": 1,
        "username": "lucas"
    }
]

GET /game/all?user=1 : Get all games wich user 1 is player

[
    {
        "id": 4,
        "state": 2,
        "adv": "florian",
        "winner": {
            "username": "lucas"
        },
        "pointsA": 3,
        "pointsB": 1
    },
    {
        "id": 6,
        "state": 1,
        "adv": "florian",
        "winner": null,
        "pointsA": null,
        "pointsB": null
    },
    {
        "id": 9,
        "state": 0,
        "adv": null,
        "winner": null,
        "pointsA": null,
        "pointsB": null
    }
]

GET /game?user=1 : User 1 start searching a game, but nobody is looking for

{
    "id": 9,
    "state": 0,
    "adv": null,
    "winner": null,
    "pointsA": null,
    "pointsB": null
}

GET /game?user=2 : User 2 start searching a game and user "lucas" too

{
    "game": {
        "id": 9,
        "state": 1,
        "adv": "lucas",
        "winner": null,
        "pointsA": null,
        "pointsB": null
    },
    "rounds": [
        {
            "id": 17,
            "numRound": 1,
            "question": {
                "id": 3,
                "question": "Moi ou toi ?",
                "responseA": "Moi",
                "responseB": "Toi",
                "responseC": "Lui",
                "responseD": "Et tous ceux qui le veulent",
                "answer": "ResponseA"
            }
        },
        {
            "id": 18,
            "numRound": 2,
            "question": {
                "id": 5,
                "question": "Bonjour ou pas du tout ?",
                "responseA": "Non",
                "responseB": "Chut",
                "responseC": "Bonjour",
                "responseD": "Lol",
                "answer": "ResponseB"
            }
        },
        {
            "id": 19,
            "numRound": 3,
            "question": {
                "id": 6,
                "question": "J'ai plus d'idée ?",
                "responseA": "Oui",
                "responseB": "C'est la galère",
                "responseC": "Non",
                "responseD": "Bonjour",
                "answer": "ResponseA"
            }
        }
    ]
}

GET /game/status?user=1&game=4 : User 1 is waiting for an user to play against, he send this request to know if someone want to play, and there is someone

{
    "game": {
        "id": 4,
        "state": 2,
        "adv": null,
        "winner": {
            "id": 1,
            "username": "lucas"
        },
        "pointsA": 3,
        "pointsB": 1
    },
    "rounds": [
        {
            "id": 6,
            "numRound": 1,
            "question": {
                "id": 1,
                "question": "L'oeuf ou la poule ?",
                "responseA": "L'oeuf",
                "responseB": "Poule",
                "responseC": "Chuck Norris",
                "responseD": "Jordan Ferri",
                "answer": "ResponseD"
            }
        },
        {
            "id": 7,
            "numRound": 2,
            "question": {
                "id": 5,
                "question": "Bonjour ou pas du tout ?",
                "responseA": "Non",
                "responseB": "Chut",
                "responseC": "Bonjour",
                "responseD": "Lol",
                "answer": "ResponseB"
            }
        },
        {
            "id": 8,
            "numRound": 3,
            "question": {
                "id": 2,
                "question": "Le ou la ?",
                "responseA": "Le",
                "responseB": "La",
                "responseC": "Non",
                "responseD": "Jordan Ferri",
                "answer": "ResponseC"
            }
        }
    ]
}

POST /response : send all response of the user 2 for the game 13 BODY :

{
  "user": 2,
  "game": 13,
  "answers": [
    {
      "roundId": 32,
      "answer": "ResponseC"
    },
    {
      "roundId": 33,
      "answer": "ResponseB"
    },
    {
      "roundId": 34,
      "answer": "ResponseA"
    }
  ]
}

RESPONSE :

{
    "game": {
        "id": 13,
        "state": 2,
        "userA": {
            "id": 2,
            "username": "florian"
        },
        "userB": {
            "id": 1,
            "username": "lucas"
        },
        "adv": {
            "id": 2,
            "username": "florian"
        },
        "winner": {
            "id": 1,
            "username": "lucas"
        },
        "pointsA": 3,
        "pointsB": 2
    },
    "rounds": [
        {
            "id": 32,
            "numRound": 1,
            "state": 2,
            "question": {
                "id": 4,
                "question": "Pourquoi pas ?",
                "responseA": "Pourquoi",
                "responseB": "Pas",
                "responseC": "Non",
                "responseD": "Oui",
                "answer": "ResponseC"
            },
            "responseUA": {
                "response": "ResponseC"
            },
            "responseUB": {
                "response": "ResponseC"
            }
        },
        {
            "id": 33,
            "numRound": 2,
            "state": 2,
            "question": {
                "id": 5,
                "question": "Bonjour ou pas du tout ?",
                "responseA": "Non",
                "responseB": "Chut",
                "responseC": "Bonjour",
                "responseD": "Lol",
                "answer": "ResponseB"
            },
            "responseUA": {
                "response": "ResponseB"
            },
            "responseUB": {
                "response": "ResponseB"
            }
        },
        {
            "id": 34,
            "numRound": 3,
            "state": 2,
            "question": {
                "id": 6,
                "question": "J'ai plus d'idée ?",
                "responseA": "Oui",
                "responseB": "C'est la galère",
                "responseC": "Non",
                "responseD": "Bonjour",
                "answer": "ResponseA"
            },
            "responseUA": {
                "response": "ResponseA"
            },
            "responseUB": null
        }
    ]
}