From 229fb6ba0b535d4a1aa6593dab6da5586b2c6737 Mon Sep 17 00:00:00 2001 From: Ton Date: Fri, 25 Oct 2024 13:28:34 +0200 Subject: [PATCH 1/2] little fixes --- src/impl/Article/router_v1.py | 4 ++-- src/impl/Event/router_v1.py | 4 ++-- src/impl/Event/service.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/impl/Article/router_v1.py b/src/impl/Article/router_v1.py index 32baeb05..2c0cfeb5 100644 --- a/src/impl/Article/router_v1.py +++ b/src/impl/Article/router_v1.py @@ -21,8 +21,8 @@ def get_all(): @router.get("/{id}", response_model=Union[ArticleGetAll, ArticleGet]) -def get(): - return article_service.get(id) +def get_by_id(id: int): + return article_service.get_by_id(id) @router.put("/{id}") diff --git a/src/impl/Event/router_v1.py b/src/impl/Event/router_v1.py index 81f0f4c4..89f609df 100644 --- a/src/impl/Event/router_v1.py +++ b/src/impl/Event/router_v1.py @@ -11,7 +11,7 @@ from src.impl.Event.schema import EventGetAll from src.impl.Event.schema import EventUpdate from src.impl.Event.service import EventService -from src.impl.Hacker.schema import HackerGet +from src.impl.Hacker.schema import HackerGet, HackerGetAll from src.impl.HackerGroup.schema import HackerGroupGet from src.impl.Meal.schema import MealGet from src.utils.JWTBearer import JWTBearer @@ -177,7 +177,7 @@ def remove_sponsor(id: int, return {'success': True, 'event_id': event.id} -@router.get("/{eventId}/get_approved_hackers", response_model=List[HackerGet]) +@router.get("/{eventId}/get_approved_hackers", response_model=List[HackerGetAll]) def get_accepted_hackers(eventId: int, token: BaseToken = Depends(JWTBearer())): return event_service.get_accepted_hackers(eventId, token) diff --git a/src/impl/Event/service.py b/src/impl/Event/service.py index d4289899..97be4d69 100644 --- a/src/impl/Event/service.py +++ b/src/impl/Event/service.py @@ -329,7 +329,7 @@ def get_accepted_hackers(self, event_id: int, data: BaseToken): if not data.check([UserType.LLEIDAHACKER]): raise AuthenticationException("Not authorized") event = self.get_by_id(event_id) - return HackerGetAll.model_validate(event.accepted_hackers) + return event.accepted_hackers def get_accepted_hackers_mails(self, event_id: int, data: BaseToken): if not data.check([UserType.LLEIDAHACKER]): From c48ab800bf85113d903d3c3d5cb964b14b1f0457 Mon Sep 17 00:00:00 2001 From: github-actions Date: Fri, 25 Oct 2024 14:43:11 +0000 Subject: [PATCH 2/2] Automated autoyapf fixes --- src/impl/Event/router_v1.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/impl/Event/router_v1.py b/src/impl/Event/router_v1.py index 73fead61..f95138ff 100644 --- a/src/impl/Event/router_v1.py +++ b/src/impl/Event/router_v1.py @@ -177,7 +177,8 @@ def remove_sponsor(id: int, return {'success': True, 'event_id': event.id} -@router.get("/{eventId}/get_approved_hackers", response_model=List[HackerGetAll]) +@router.get("/{eventId}/get_approved_hackers", + response_model=List[HackerGetAll]) def get_accepted_hackers(eventId: int, token: BaseToken = Depends(JWTBearer())): return event_service.get_accepted_hackers(eventId, token)