create base models(users,tasks)
This commit is contained in:
8
src/api/__init__.py
Normal file
8
src/api/__init__.py
Normal file
@@ -0,0 +1,8 @@
|
||||
from fastapi import APIRouter
|
||||
from src.api.users import router as users_router
|
||||
from src.api.tasks import router as tasks_router
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
router.include_router(router=users_router)
|
||||
router.include_router(router=tasks_router)
|
||||
0
src/api/auth.py
Normal file
0
src/api/auth.py
Normal file
14
src/api/dependancies.py
Normal file
14
src/api/dependancies.py
Normal file
@@ -0,0 +1,14 @@
|
||||
from typing import Annotated
|
||||
|
||||
from fastapi import Depends
|
||||
from sqlalchemy.ext.asyncio import AsyncSession
|
||||
|
||||
from src.db.database import async_session_maker
|
||||
|
||||
|
||||
async def get_db():
|
||||
async with async_session_maker as db:
|
||||
yield db
|
||||
|
||||
|
||||
DBDep = Annotated[AsyncSession, Depends(get_db)]
|
||||
27
src/api/tasks.py
Normal file
27
src/api/tasks.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter(prefix="/tasks", tags=["Tasks"])
|
||||
|
||||
|
||||
@router.get("/")
|
||||
async def get_tasks(): ...
|
||||
|
||||
|
||||
@router.get("/{task_id}")
|
||||
async def get_task_id(task_id: int): ...
|
||||
|
||||
|
||||
@router.post("/")
|
||||
async def post_task(): ...
|
||||
|
||||
|
||||
@router.put("/{task_id}")
|
||||
async def put_task(task_id: int): ...
|
||||
|
||||
|
||||
@router.patch("/{task_id}")
|
||||
async def patch_task(task_id: int): ...
|
||||
|
||||
|
||||
@router.delete("/{task_id}")
|
||||
async def delete_task(task_id: int): ...
|
||||
3
src/api/users.py
Normal file
3
src/api/users.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from fastapi import APIRouter
|
||||
|
||||
router = APIRouter(prefix="/users", tags=["Users"])
|
||||
Reference in New Issue
Block a user