2023-10-05 10:47:29 +03:00
|
|
|
from fastapi import APIRouter, Depends
|
2023-11-15 15:17:51 +03:00
|
|
|
from middlewares.auth import ( # Assuming you have a get_current_user function
|
|
|
|
AuthBearer,
|
2023-11-14 16:31:02 +03:00
|
|
|
get_current_user,
|
2023-11-15 15:17:51 +03:00
|
|
|
)
|
2023-11-24 12:25:02 +03:00
|
|
|
from modules.onboarding.dto.inputs import OnboardingUpdatableProperties
|
|
|
|
from modules.onboarding.entity.onboarding import OnboardingStates
|
|
|
|
from modules.onboarding.service.onboarding_service import OnboardingService
|
2023-11-15 15:17:51 +03:00
|
|
|
from modules.user.entity.user_identity import UserIdentity
|
2023-10-05 10:47:29 +03:00
|
|
|
|
|
|
|
onboarding_router = APIRouter()
|
|
|
|
|
2023-11-24 12:25:02 +03:00
|
|
|
onboardingService = OnboardingService()
|
|
|
|
|
2023-10-05 10:47:29 +03:00
|
|
|
|
|
|
|
@onboarding_router.get(
|
|
|
|
"/onboarding",
|
|
|
|
dependencies=[Depends(AuthBearer())],
|
|
|
|
tags=["Onboarding"],
|
|
|
|
)
|
|
|
|
async def get_user_onboarding_handler(
|
|
|
|
current_user: UserIdentity = Depends(get_current_user),
|
2023-10-06 13:37:12 +03:00
|
|
|
) -> OnboardingStates | None:
|
2023-10-05 10:47:29 +03:00
|
|
|
"""
|
|
|
|
Get user onboarding information for the current user
|
|
|
|
"""
|
|
|
|
|
2023-11-24 12:25:02 +03:00
|
|
|
return onboardingService.get_user_onboarding(current_user.id)
|
2023-10-05 10:47:29 +03:00
|
|
|
|
|
|
|
|
|
|
|
@onboarding_router.put(
|
|
|
|
"/onboarding",
|
|
|
|
dependencies=[Depends(AuthBearer())],
|
|
|
|
tags=["Onboarding"],
|
|
|
|
)
|
|
|
|
async def update_user_onboarding_handler(
|
|
|
|
onboarding: OnboardingUpdatableProperties,
|
|
|
|
current_user: UserIdentity = Depends(get_current_user),
|
2023-10-06 13:37:12 +03:00
|
|
|
) -> OnboardingStates:
|
2023-10-05 10:47:29 +03:00
|
|
|
"""
|
|
|
|
Update user onboarding information for the current user
|
|
|
|
"""
|
|
|
|
|
2023-11-24 12:25:02 +03:00
|
|
|
return onboardingService.update_user_onboarding(current_user.id, onboarding)
|