Giter Site home page Giter Site logo

mega-sena's Introduction

Teste Técnico Mega Sena

API que faz jogos da mega sena, o usuario escolhe a quantidade de dezenas por jogo e a API irá gerar aleatoriamente dezenas para o usuário. O usuário poderá consultar o resultado do ultimo jogo e comparar com suas dezenas para conferir quantos numeros acertou.

Base URL

https://localhost:8000

Endpoints

POST /api/accounts/register/

Register one user

Body

{
  "username": "admin",
  "password": "1234",
  "is_superuser": true,
  "is_staff": true
}

Response Return

{
  "id": 1,
  "username": "admin",
  "is_staff": true,
  "is_superuser": true
}

POST /api/accounts/login/

Login with a user

Body

{
  "username": "admin",
  "password": "1234"
}

Response Return

{
  "token": "BARER TOKEN"
}

PUT /api/accounts/edit/

Edit one user

header

Authorization: 'Bearer ' + <TOKEN>

Body

{
  "username": "admin",
  "password": "1234",
  "is_staff": false, // Opicional (only a is_staff true can edit to a false)
  "is_superuser": false, // Opicional (only a is_superuser true can edit to a false)
}

Response Return

{
  "id": 1,
  "username": "admin",
  "password": "1234",
  "is_staff": true,
  "is_superuser": true
}

DELETE /api/accounts/delete/

Delete / Desativate the user

header

Authorization: 'Bearer ' + <TOKEN>

Response Return -> 204 NOT CONTENT

Games

POST /api/games/

Create a game

header

Authorization: 'Bearer ' + <TOKEN>

Body

{
  "numbers": 10
}

Response Return

{
  "id": 1,
  "numbers": [33, 50, 19, 16, 38, 11, 14, 43, 30, 8],
  "user": {
    "id": 1,
    "username": "admin",
    "is_superuser": true,
    "is_staff": true
  },
  "date": "2021-04-14",
  "time": "19:13:21.868947"
}

GET /api/games/

List all user games

header

Authorization: 'Bearer ' + <TOKEN>

Response Return

[
 {
   "id": 1,
   "numbers": [33, 50, 19, 16, 38, 11, 14, 43, 30, 8],
   "user": {
     "id": 1,
     "username": "admin",
     "is_superuser": true,
     "is_staff": true
   },
   "date": "2021-04-14",
   "time": "19:13:21.868947"
 },
]

GET /api/games/game_id/

Retrive one user game

header

Authorization: 'Bearer ' + <TOKEN>

Response Return

[
 {
   "id": 1,
   "numbers": [33, 50, 19, 16, 38, 11, 14, 43, 30, 8],
   "user": {
     "id": 1,
     "username": "admin",
     "is_superuser": true,
     "is_staff": true
   },
   "date": "2021-04-14",
   "time": "19:13:21.868947"
 },
]

GET /api/games/game_id/result

Retrive one user game result

header

Authorization: 'Bearer ' + <TOKEN>

Response Return

{
  "winning_numbers": [14, 21, 22, 29, 35, 46],
  "game_numbers": [33, 50, 19, 16, 38, 11, 14, 43, 30, 8],
  "matching_numbers": [14]
}

GET /api/games/megasena/

Retrive the mega sena result

header

Authorization: 'Bearer ' + <TOKEN>

Response Return

[14, 21, 22, 29, 35, 46]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.