From f5d823dd14ff53d6d64d4786e7e0a1ff9fb41cf1 Mon Sep 17 00:00:00 2001 From: BimaAdi Date: Sat, 13 Dec 2025 09:07:01 +0700 Subject: [PATCH 1/4] Add participant type to test user and simplify user model response handling --- routes/tests/test_checkin.py | 1 + schemas/checkin.py | 6 ++---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/routes/tests/test_checkin.py b/routes/tests/test_checkin.py index 77e77f8..283f1aa 100644 --- a/routes/tests/test_checkin.py +++ b/routes/tests/test_checkin.py @@ -42,6 +42,7 @@ def setUp(self) -> None: last_name="user", password=generate_hash_password("password"), is_active=True, + participant_type="Student" ) self.db.add(self.test_user) self.db.commit() diff --git a/schemas/checkin.py b/schemas/checkin.py index c2711e0..191a649 100644 --- a/schemas/checkin.py +++ b/schemas/checkin.py @@ -34,10 +34,8 @@ def user_model_to_checkin_response(user: User) -> CheckinUserResponse: tshirt_size = None participant_type = None try: - tshirt_size = TShirtSize(user.t_shirt_size) if user.t_shirt_size else None - participant_type = ( - ParticipantType(user.participant_type) if user.participant_type else None - ) + tshirt_size = user.t_shirt_size + participant_type = user.participant_type except ValueError as e: logger.error(f"Invalid enum value in user model: {e}") From 2e2967c6e510654fbc6869484fcbe3f9507a9b12 Mon Sep 17 00:00:00 2001 From: BimaAdi Date: Sat, 13 Dec 2025 09:14:25 +0700 Subject: [PATCH 2/4] Fix participant_type assignment in test user creation --- routes/tests/test_checkin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routes/tests/test_checkin.py b/routes/tests/test_checkin.py index 283f1aa..7ea6bfd 100644 --- a/routes/tests/test_checkin.py +++ b/routes/tests/test_checkin.py @@ -42,7 +42,7 @@ def setUp(self) -> None: last_name="user", password=generate_hash_password("password"), is_active=True, - participant_type="Student" + participant_type="Student", ) self.db.add(self.test_user) self.db.commit() From 3c9ea167e41248434b7af1c3b7d5066a75eaac2f Mon Sep 17 00:00:00 2001 From: BimaAdi Date: Sat, 13 Dec 2025 09:18:44 +0700 Subject: [PATCH 3/4] Remove hardcoded participant_type from test user creation --- routes/tests/test_checkin.py | 1 - 1 file changed, 1 deletion(-) diff --git a/routes/tests/test_checkin.py b/routes/tests/test_checkin.py index 7ea6bfd..77e77f8 100644 --- a/routes/tests/test_checkin.py +++ b/routes/tests/test_checkin.py @@ -42,7 +42,6 @@ def setUp(self) -> None: last_name="user", password=generate_hash_password("password"), is_active=True, - participant_type="Student", ) self.db.add(self.test_user) self.db.commit() From 08013aa229ad3c0bfb71b767c993c588635aaed6 Mon Sep 17 00:00:00 2001 From: BimaAdi Date: Sat, 13 Dec 2025 09:33:08 +0700 Subject: [PATCH 4/4] Refactor CheckinUserResponse to use string types for t_shirt_size and participant_type --- routes/tests/test_checkin.py | 1 + schemas/checkin.py | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routes/tests/test_checkin.py b/routes/tests/test_checkin.py index 77e77f8..7ea6bfd 100644 --- a/routes/tests/test_checkin.py +++ b/routes/tests/test_checkin.py @@ -42,6 +42,7 @@ def setUp(self) -> None: last_name="user", password=generate_hash_password("password"), is_active=True, + participant_type="Student", ) self.db.add(self.test_user) self.db.commit() diff --git a/schemas/checkin.py b/schemas/checkin.py index 191a649..d5f31c1 100644 --- a/schemas/checkin.py +++ b/schemas/checkin.py @@ -2,7 +2,6 @@ from enum import Enum from core.log import logger from pydantic import BaseModel, EmailStr, Field -from schemas.user_profile import ParticipantType, TShirtSize from models.User import User @@ -11,8 +10,8 @@ class CheckinUserResponse(BaseModel): email: Optional[EmailStr] = None first_name: Optional[str] = None last_name: Optional[str] = None - t_shirt_size: Optional[TShirtSize] = None - participant_type: Optional[ParticipantType] = None + t_shirt_size: Optional[str] = None + participant_type: Optional[str] = None checked_in_day1: bool = False checked_in_day2: bool = False