Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

103 add tabela de chaveamento #143

Merged
merged 6 commits into from
Jun 18, 2023
Merged

Conversation

Reginaldo-Neto
Copy link
Collaborator

Descrição

CRUD de matches

Issues Relacionadas

#103

Pull Requests Relacionados

Informações Adicionais

Não tem remove pois foi dito que não era preciso, entretanto deixei comentado no código a função caso seja preciso implementá-lo.

Exemplos de URLS:

http://localhost:8000/matches/create
{
"championship_id": 7,
"team_1_id": 9,
"team_2_id": 10,
"round": 2,
"bracket": 1
}

http://localhost:8000/matches/update/1
{
"winner_team_id":10,
"result":"2x1"
}

http://localhost:8000/matches/

http://localhost:8000/championships/7/matches

Checklist:

  • Meu código resolve o problema da issue relacionada
  • Meu código segue o padrão estrutural definido para esse projeto
  • O documento CHANGELOG foi atualizado
  • Criação de match
  • Update de match
  • Listagem de matches
  • Listagem de matches by championship ID

@Reginaldo-Neto Reginaldo-Neto linked an issue Jun 15, 2023 that may be closed by this pull request
5 tasks
@vercel
Copy link

vercel bot commented Jun 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
backend-championship-platform ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 18, 2023 9:57pm

@Reginaldo-Neto Reginaldo-Neto self-assigned this Jun 15, 2023
@Reginaldo-Neto Reginaldo-Neto added the backend Backend label Jun 15, 2023
@dalacquar
Copy link
Collaborator

Algum erro está ocorrendo com a rotas do championships, não estão funcionando as rotas:

image

Error retornado:

INFO: 127.0.0.1:50486 - "POST /championships/create HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1964, in _exec_single_context
self.dialect.do_execute(
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\default.py", line 748, in do_execute
cursor.execute(statement, parameters)
psycopg2.errors.InFailedSqlTransaction: current transaction is aborted, commands ignored until end of transaction block

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 429, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 78, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\fastapi\applications.py", line 276, in call
await super().call(scope, receive, send)
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\applications.py", line 122, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\middleware\errors.py", line 184, in call
raise exc
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\middleware\errors.py", line 162, in call
await self.app(scope, receive, _send)
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\middleware\cors.py", line 84, in call
await self.app(scope, receive, send)
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 79, in call
raise exc
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\middleware\exceptions.py", line 68, in call
await self.app(scope, receive, sender)
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 21, in call
raise e
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\fastapi\middleware\asyncexitstack.py", line 18, in call
await self.app(scope, receive, send)
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\routing.py", line 718, in call
await route.handle(scope, receive, send)
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\routing.py", line 276, in handle
await self.app(scope, receive, send)
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\starlette\routing.py", line 66, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\fastapi\routing.py", line 237, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\fastapi\routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\api\routers\championships_routes.py", line 90, in create
camp = session.query(Championship).filter(Championship.name == data.name).first()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\orm\query.py", line 2752, in first
return self.limit(1)._iter().first() # type: ignore
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\orm\query.py", line 2855, in _iter
result: Union[ScalarResult[_T], Result[_T]] = self.session.execute(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2229, in execute
return self._execute_internal(
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\orm\session.py", line 2124, in _execute_internal
result: Result[Any] = compile_state_cls.orm_execute_statement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\orm\context.py", line 253, in orm_execute_statement
result = conn.execute(
^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1414, in execute
return meth(
^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\sql\elements.py", line 486, in _execute_on_connection
return connection._execute_clauseelement(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1638, in _execute_clauseelement
ret = self._execute_context(
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1842, in _execute_context
return self._exec_single_context(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1983, in _exec_single_context
self._handle_dbapi_exception(
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 2326, in _handle_dbapi_exception
raise sqlalchemy_exception.with_traceback(exc_info[2]) from e
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\base.py", line 1964, in _exec_single_context
self.dialect.do_execute(
File "C:\Users\rafae\OneDrive\Área de Trabalho\championship-platform\backend\venv\Lib\site-packages\sqlalchemy\engine\default.py", line 748, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.InternalError: (psycopg2.errors.InFailedSqlTransaction) current transaction is aborted, commands ignored until end of transaction block

[SQL: SELECT championships.id AS championships_id, championships.name AS championships_name, championships.start_time AS championships_start_time, championships.min_teams AS championships_min_teams, championships.max_teams AS championships_max_teams, championships.prizes AS championships_prizes, championships.format AS championships_format, championships.rules AS championships_rules, championships.contact AS championships_contact, championships.visibility AS championships_visibility, championships.created_at AS championships_created_at, championships.admin_id AS championships_admin_id, championships.game_id AS championships_game_id, championships.matches AS championships_matches
FROM championships
WHERE championships.name = %(name_1)s
LIMIT %(param_1)s]
[parameters: {'name_1': 'championship name', 'param_1': 1}]
(Background on this error at: https://sqlalche.me/e/20/2j85)

@KozielGPC KozielGPC changed the base branch from main to development June 18, 2023 22:00
@KozielGPC KozielGPC self-assigned this Jun 18, 2023
@KozielGPC KozielGPC merged commit 1581be1 into development Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Adicionar tabela de chaveamento
3 participants