{"id":18305245,"url":"https://github.com/vladimir-ivanov-92/competitions_fastapi","last_synced_at":"2026-05-09T09:06:27.875Z","repository":{"id":221697588,"uuid":"755039548","full_name":"Vladimir-Ivanov-92/competitions_FastAPI","owner":"Vladimir-Ivanov-92","description":"The application provides api for saving the results of tournaments in various sports, indicating the participants of tournaments and their places.","archived":false,"fork":false,"pushed_at":"2024-02-09T10:41:26.000Z","size":91,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T04:44:04.527Z","etag":null,"topics":["fastapi","postgresql","redis-cache","sqlalchemy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Vladimir-Ivanov-92.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-02-09T10:06:20.000Z","updated_at":"2024-02-09T12:58:36.000Z","dependencies_parsed_at":"2024-02-09T15:03:08.627Z","dependency_job_id":"a3cc7c4c-ab6a-43df-b524-71704449e9a8","html_url":"https://github.com/Vladimir-Ivanov-92/competitions_FastAPI","commit_stats":null,"previous_names":["vladimir-ivanov-92/competitions_fastapi"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vladimir-Ivanov-92%2Fcompetitions_FastAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vladimir-Ivanov-92%2Fcompetitions_FastAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vladimir-Ivanov-92%2Fcompetitions_FastAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Vladimir-Ivanov-92%2Fcompetitions_FastAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Vladimir-Ivanov-92","download_url":"https://codeload.github.com/Vladimir-Ivanov-92/competitions_FastAPI/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248024195,"owners_count":21035218,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","postgresql","redis-cache","sqlalchemy"],"created_at":"2024-11-05T15:33:28.407Z","updated_at":"2026-05-09T09:06:27.805Z","avatar_url":"https://github.com/Vladimir-Ivanov-92.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Competitions_API\n\nПриложение предоставляюще api для сохранения результатов турниров по различным видам спорта с \nуказанием участников турниров и занятых ими мест.\n\n### В данном проекте использовались следующие инструменты:\n\n- python v3.11\n- fastapi v0.109.2\n- sqlalchemy v2.0.25\n- alembic v1.13.1\n- asyncpg v0.29\n- uvicorn v^0.27\n- gunicorn v21.2\n- redis v5.0.1\n- requests v2.31\n- fastapi-cache2 v0.2.1\n\n```\nget(\"/tournaments/\") - список всех турниров c указанием участников \n каждого турнира и занятых ими мест (в порядке убывания)\n\nResponse:\n[\n  {\n    \"id\": int,\n    \"datetime\": datetime,\n    \"sport_id\": str,\n    \"name\": str,\n    \"athletes\": [\n      {\n        \"id\": int,\n        \"first_name\": str,\n        \"last_name\": str,\n        \"country\": str,\n        \"place\": int\n      }\n    ]\n  }\n]\n```\n\n```\npost(\"/tournaments/\") - Добавление данных о турнире в БД\n\nRequest: \n{\n  \"tournament\": {\n    \"datetime\": datetime,\n    \"sport_id\": int,\n    \"name\": str\n  },\n  \"athletes_with_place\": [\n    {\n      \"athlete_id\": int,\n      \"place\": int\n    }\n  ]\n}\n\nResponse:\n{\n  \"id\": int,\n  \"datetime\": str,\n  \"sport_id\": int,\n  \"name\": str\n}\n```\n\n```\nget(\"/tournaments/{year}/{month}\") - Получение данных всех турниров \nс фильтром по переданным данным (год, месяц)\n\nResponse:\n[\n  {\n    \"id\": int,\n    \"datetime\": datetime,\n    \"sport_id\": str,\n    \"name\": str,\n    \"athletes\": [\n      {\n        \"id\": int,\n        \"first_name\": str,\n        \"last_name\": str,\n        \"country\": \"str,\n        \"place\": int\n      }\n    ]\n  }\n]\n```\n\n```\nget(\"/athletes/\") - Получение данных всех спортсменов\nResponse:\n[\n  {\n    \"id\": int,\n    \"first_name\": str,\n    \"last_name\": str,\n    \"age\": int,\n    \"country\": str,\n    \"sport_name\": str\n  }\n]\n```\n\n```\npost(\"/athletes/\") - Добавление данных спортсмена в БД\n\nRequest: \n{\n  \"first_name\": str,\n  \"last_name\": str,\n  \"age\": int,\n  \"country\": str,\n  \"sport_id\": int\n}\n        \nResponse:\n{\n  \"id\": int,\n  \"first_name\": str,\n  \"last_name\": str,\n  \"age\": int,\n  \"country\": str,\n  \"sport_id\": int\n}\n```\n\n```\nget(\"/athletes/{athlete_id}\") - Получение данных о спортсмене по id\nResponse:\n{\n  \"id\": int,\n  \"first_name\": str,\n  \"last_name\": str,\n  \"age\": int,\n  \"country\": str,\n  \"sport_name\": str\n}\n```\n\n```\npost(\"/athletes/sport\") - Добавление нового вида спорта в БД\n\nRequest: \n{\n  \"name\": str\n}\n        \nResponse:\n{\n  \"id\": int,\n  \"name\": str\n}\n```\n\nВ приложении используется кэширование для некоторых обработчиков с помщью redis и библиотеки \nfastapi-cache2:\n```python\n@router.get(\"/{year}/{month}\", response_model=list[TournamentResponseList])\n@cache(expire=EXPIRE)\nasync def get_tournaments_filter_year_month()\n...\n```\n\n## Настройка и запуск:\n\nПерейдите в директорию, в которую будете клонировать репозиторий. \nНеобходимо наличие установленного и запущенного Docker.\nДля скачивания репозитория и разворачивания проекта локально в docker контейнере \n(создание БД, запуск приложения):\n\ngit clone https://github.com/Vladimir-Ivanov-92/DRF_API_Exchange_Rate.git\n\nНеобходимо создать в текущей директории .env файл \nи заполнить данными по образцу .env.example\n\nДля автоматизации сборки проекта в репозитории размещен Makefile. Для запуска приложения\nвыполните: \n\n```\nmake up  - создаст Docker контейнеры \"app\" \"db\" \"redis\" и запустит приложение \nс помощью gunicorn\n\nmake migrate\"- выполнит миграции БД\n\nmake down -  остановит и удалит все созданные контейнеры\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladimir-ivanov-92%2Fcompetitions_fastapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvladimir-ivanov-92%2Fcompetitions_fastapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvladimir-ivanov-92%2Fcompetitions_fastapi/lists"}