Skip to content

Commit

Permalink
add accidentally deleted function again
Browse files Browse the repository at this point in the history
  • Loading branch information
MaHaWo committed Oct 18, 2024
1 parent 4ff8432 commit d0349d0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions mondey_backend/src/mondey_backend/routers/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from fastapi import HTTPException
from fastapi import UploadFile
from fastapi.responses import FileResponse
from sqlmodel import col
from sqlmodel import select

from ..dependencies import CurrentActiveUserDep
from ..dependencies import SessionDep
Expand All @@ -30,6 +32,15 @@ def create_router() -> APIRouter:
router = APIRouter(prefix="/users", tags=["users"])
router.include_router(fastapi_users.get_users_router(UserRead, UserUpdate))

@router.get("/children/", response_model=list[ChildPublic])
def get_children(session: SessionDep, current_active_user: CurrentActiveUserDep):
return [
child
for child in session.exec(
select(Child).where(col(Child.user_id) == current_active_user.id)
).all()
]

@router.post("/children/", response_model=ChildPublic)
def create_child(
session: SessionDep,
Expand Down

0 comments on commit d0349d0

Please sign in to comment.