struct
This commit is contained in:
parent
7281477269
commit
8cefa60d3a
6 changed files with 33 additions and 1 deletions
|
|
@ -0,0 +1 @@
|
|||
|
||||
12
items/models.py
Normal file
12
items/models.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from datetime import datetime, timedelta, timezone
|
||||
from ..auth.models import UserInDb
|
||||
|
||||
class UserProfile(UserInDb):
|
||||
bio : str | None = None
|
||||
created_date : datetime | None = None
|
||||
collections : list[str] | None = None
|
||||
items :list[str] | None = None
|
||||
|
||||
|
||||
|
||||
|
||||
18
items/router.py
Normal file
18
items/router.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
from .models import UserProfile
|
||||
from fastapi import APIRouter, Depends
|
||||
from typing import Annotated
|
||||
from ..auth.models import get_current_active_user
|
||||
|
||||
router = APIRouter(
|
||||
prefix="/items",
|
||||
tags=["items"],
|
||||
responses={404: {"description": "Not found"}},
|
||||
dependencies=[],
|
||||
)
|
||||
|
||||
@router.get('/profile', response_model=UserProfile)
|
||||
async def get_user_profile(
|
||||
current_user: Annotated[UserProfile, Depends(get_current_active_user)]
|
||||
) -> UserProfile:
|
||||
|
||||
return current_user
|
||||
3
main.py
3
main.py
|
|
@ -1,8 +1,9 @@
|
|||
from .config import app
|
||||
from .auth.router import router as auth_router
|
||||
from .items.router import router as items_router
|
||||
|
||||
app.include_router(auth_router)
|
||||
|
||||
app.include_router(items_router)
|
||||
|
||||
'''
|
||||
from fastapi import FastAPI
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue