Skip to content

Commit

Permalink
feat: add /events/:id route
Browse files Browse the repository at this point in the history
  • Loading branch information
seelengxd committed Sep 22, 2024
1 parent 7cb3756 commit 8ce1d77
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions backend/src/events/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from src.auth.schemas import UserPublic
from src.events.models import Category, Event
from src.common.dependencies import get_session
from src.events.schemas import EventIndexResponse
from src.events.schemas import EventDTO, EventIndexResponse
from src.profile.schemas import ProfileUpdate


Expand Down Expand Up @@ -43,5 +43,13 @@ def get_events(


@router.get("/:id")
def get_event(id: int):
pass
def get_event(
id: int,
_: Annotated[User, Depends(get_current_user)],
session=Depends(get_session),
) -> EventDTO:
event = session.scalar(
select(Event).where(Event.id == id).options(selectinload(Event.categories))
)
# TODO: link to more models, give more data
return event

0 comments on commit 8ce1d77

Please sign in to comment.