Skip to content

Commit 11822ba

Browse files
authored
Create account.py
1 parent 3a88449 commit 11822ba

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

‎app/routes/account.py‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"""Account route: the profile read model for the UI.
2+
3+
HTTP wiring only; the payload is assembled in ``controllers.accounts``.
4+
"""
5+
6+
from __future__ import annotations
7+
8+
from fastapi import APIRouter, Depends
9+
from sqlalchemy.orm import Session
10+
11+
from ..controllers import accounts
12+
from ..infra.db import get_db
13+
from ..models import User
14+
from ..routes.auth import authenticate_user
15+
from ..validation.schemas import AccountProfile
16+
17+
router = APIRouter(prefix="/account", tags=["account"])
18+
19+
20+
@router.get("/profile", response_model=AccountProfile)
21+
def get_profile(
22+
user: User = Depends(authenticate_user), db: Session = Depends(get_db)
23+
) -> AccountProfile:
24+
return AccountProfile(**accounts.profile(db, user))

0 commit comments

Comments
 (0)