Refactor event retrieval and improve test coverage
All checks were successful
Build and Push Docker Images / changes (push) Successful in 4s
Build and Push Docker Images / build-backend (push) Successful in 51s
Build and Push Docker Images / build-frontend (push) Has been skipped

Removed redundant code for event retrieval and standardized logic by introducing a unified method for generating event endpoints. Updated tests to align with these changes, adding support for slug-based access and handling finer permission cases. Minor issues with test formatting and comments were also addressed.
This commit is contained in:
2025-03-11 06:47:58 +01:00
parent 80ff350053
commit f245145087
2 changed files with 37 additions and 40 deletions

View File

@@ -239,7 +239,6 @@ def get_event(
current_user: Optional[User] = Depends(get_current_user)
) -> EventResponse:
"""Get event by ID."""
print("Getting event")
try:
event_obj = event.get(db=db, id=event_id)
return validate_event_access(
@@ -270,8 +269,7 @@ def get_event_by_slug(
) -> EventResponse:
"""Get event by slug."""
try:
event_obj = event.get_public_event(db=db, slug=slug, access_code=access_code)
event_obj = event.get_by_slug(db=db, slug=slug)
return validate_event_access(
db=db,
event_obj=event_obj,