[go: up one dir, main page]

Skip to content

Aplicação web full stack, desenvolvida em monorepo com o objetivo de registrar e organizar a pontuação em um campeonato de futebol fictício.

License

Notifications You must be signed in to change notification settings

hiagoisoppo/trybe-futebol-club

Repository files navigation

Application Preview

Trybe Futebol Clube

Static Badge Static Badge Static Badge Static Badge Static Badge
Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge Static Badge

Descrição:

Trybe Futebol Clube é uma aplicação web full stack desenvolvida em monorepo com o objetivo de registrar e organizar a pontuação em um campeonato de futebol fictício. Durante o desenvolvimento foi utilizado as seguintes tecnologias: TypeScript, ReactJs, ExpressJs, Nodemon, Sequelize, MySQL, ReactTestingLibrary, ReactRouterDom, Axios, Jest, Puppeteer, Mocha, Chai, Sinon, JsonWebToken, BcryptJs, Joi, TsNode, Docker.

Funcionalidades:

  • Aba de Classificação com listagem dos times associados ao torneio e seus respectivos status.
  • Aba de Partidas com busca e filtragem dos dados atualizados de partidas finalizadas e em andamento.
  • Acesso ao dashboard administrativo através do login, onde podem ser atualizados os dados de partidas em andamento.

Como acessar a aplicação

⚠️ Antes de começar, seu docker-compose precisa estar na versão 1.29 ou superior. Veja aqui ou na documentação como instalá-lo. No primeiro artigo, você pode substituir onde está 1.26.0 por1.29.2.

  • Abra o terminal e faça um clone do repositório.
  git clone git@github.com:hiagoisoppo/trybe-futebol-club.git
  • Acesse a pasta clonada do repositório, e instale as dependências.
  cd trybe-futebol-club
  npm install
  npm run install:apps
  • Execute os serviços frontend, backend edb.
  npm run compose:up

API REST - Endpoints

GET /

  • Health check response:
{
  "ok": true
}

GET /teams

  • Response:
[
  {
  	"id": 1,
  	"teamName": "Avaí/Kindermann"
  },
  {
  	"id": 2,
  	"teamName": "Bahia"
  },
  ...
]

GET /teams/:id

  • Response:
{
  "id": 2,
  "teamName": "Bahia"
}

POST /login

  • Send Body:
{
  "email": "admin@admin.com",
  "password": "secret_admin"
}
  • Response:
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJBZG1pbiIsImlhdCI6MTcwNDMwNzY1MH0.c6nkn1AaCQsV8dESvGWWQuyXkMstHcjGW6toa51FODk"
}

GET /login/role

  • Send Header:
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJBZG1pbiIsImlhdCI6MTcwNDMwNzY1MH0.c6nkn1AaCQsV8dESvGWWQuyXkMstHcjGW6toa51FODk"
}
  • Response:
{
  "role": "admin"
}

GET /matches

Filter options /matches?inProgress=boolean
  • Response:
[
  {
    "id": 1,
    "homeTeamId": 16,
    "homeTeamGoals": 1,
    "awayTeamId": 8,
    "awayTeamGoals": 1,
    "inProgress": false,
    "homeTeam": {
      "teamName": "São Paulo"
    },
    "awayTeam": {
      "teamName": "Grêmio"
    }
  },
  {
    "id": 2,
    "homeTeamId": 9,
    "homeTeamGoals": 1,
    "awayTeamId": 14,
    "awayTeamGoals": 1,
    "inProgress": false,
    "homeTeam": {
      "teamName": "Internacional"
    },
    "awayTeam": {
      "teamName": "Santos"
    }
  },
  ...
]

PATCH /matches/:id/finish

  • Send Header:
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJBZG1pbiIsImlhdCI6MTcwNDMwNzY1MH0.c6nkn1AaCQsV8dESvGWWQuyXkMstHcjGW6toa51FODk"
}
  • Response:
{
  "message": "Finished"
}

PATCH /matches/:id

  • Send Header:
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJBZG1pbiIsImlhdCI6MTcwNDMwNzY1MH0.c6nkn1AaCQsV8dESvGWWQuyXkMstHcjGW6toa51FODk"
}
  • Send Body:
{
  "homeTeamGoals": 3,
  "awayTeamGoals": 1
}
  • Response:
{
  "id": 41,
  "homeTeamId": 16,
  "homeTeamGoals": 3,
  "awayTeamId": 9,
  "awayTeamGoals": 1,
  "inProgress": true
}

POST /matches

  • Send Header:
{
  "Authorization": "Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwidXNlcm5hbWUiOiJBZG1pbiIsImlhdCI6MTcwNDMwNzY1MH0.c6nkn1AaCQsV8dESvGWWQuyXkMstHcjGW6toa51FODk"
}
  • Send Body:
{
  "homeTeamId": 16, // O valor deve ser o id do time
  "awayTeamId": 8, // O valor deve ser o id do time
  "homeTeamGoals": 2,
  "awayTeamGoals": 2
}
  • Response:
{
  "id": 49,
  "homeTeamId": 16,
  "homeTeamGoals": 2,
  "awayTeamId": 8,
  "awayTeamGoals": 2,
  "inProgress": true
}

GET /leaderboard

  • Response:
[
  {
    "name": "Palmeiras",
    "totalPoints": "13",
    "totalGames": 5,
    "totalVictories": "4",
    "totalDraws": "1",
    "totalLosses": "0",
    "goalsFavor": "17",
    "goalsOwn": "5",
    "goalsBalance": "12",
    "efficiency": "86.67"
  },
  {
    "name": "Corinthians",
    "totalPoints": "12",
    "totalGames": 5,
    "totalVictories": "4",
    "totalDraws": "0",
    "totalLosses": "1",
    "goalsFavor": "12",
    "goalsOwn": "3",
    "goalsBalance": "9",
    "efficiency": "80.00"
  },
  {
    "name": "Santos",
    "totalPoints": "11",
    "totalGames": 5,
    "totalVictories": "3",
    "totalDraws": "2",
    "totalLosses": "0",
    "goalsFavor": "12",
    "goalsOwn": "6",
    "goalsBalance": "6",
    "efficiency": "73.33"
  },
  ...
]

GET /leaderboard/home

  • Response:
[
  {
    "name": "Santos",
    "totalPoints": "9",
    "totalGames": 3,
    "totalVictories": "3",
    "totalDraws": "0",
    "totalLosses": "0",
    "goalsFavor": "9",
    "goalsOwn": "3",
    "goalsBalance": "6",
    "efficiency": "100.00"
  },
  {
    "name": "Palmeiras",
    "totalPoints": "7",
    "totalGames": 3,
    "totalVictories": "2",
    "totalDraws": "1",
    "totalLosses": "0",
    "goalsFavor": "10",
    "goalsOwn": "5",
    "goalsBalance": "5",
    "efficiency": "77.78"
  },
  {
    "name": "São Paulo",
    "totalPoints": "6",
    "totalGames": 2,
    "totalVictories": "2",
    "totalDraws": "0",
    "totalLosses": "0",
    "goalsFavor": "6",
    "goalsOwn": "1",
    "goalsBalance": "5",
    "efficiency": "100.00"
  },
  ...
]

GET /leaderboard/away

  • Response:
[
  {
    "name": "Palmeiras",
    "totalPoints": "6",
    "totalGames": 2,
    "totalVictories": "2",
    "totalDraws": "0",
    "totalLosses": "0",
    "goalsFavor": "7",
    "goalsOwn": "0",
    "goalsBalance": "7",
    "efficiency": "100.00"
  },
  {
    "name": "Corinthians",
    "totalPoints": "6",
    "totalGames": 3,
    "totalVictories": "2",
    "totalDraws": "0",
    "totalLosses": "1",
    "goalsFavor": "6",
    "goalsOwn": "2",
    "goalsBalance": "4",
    "efficiency": "66.67"
  },
  {
    "name": "Internacional",
    "totalPoints": "6",
    "totalGames": 2,
    "totalVictories": "2",
    "totalDraws": "0",
    "totalLosses": "0",
    "goalsFavor": "3",
    "goalsOwn": "0",
    "goalsBalance": "3",
    "efficiency": "100.00"
  },
  ...
]

Application Preview