From b54377df19dd056e0567f2a600fe699a690daaf2 Mon Sep 17 00:00:00 2001 From: mamadoudicko Date: Wed, 4 Oct 2023 16:17:37 +0200 Subject: [PATCH] feat: add onboarding controller --- backend/routes/onboarding_routes.py | 42 +++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 backend/routes/onboarding_routes.py diff --git a/backend/routes/onboarding_routes.py b/backend/routes/onboarding_routes.py new file mode 100644 index 000000000000..7c2ca348c01d --- /dev/null +++ b/backend/routes/onboarding_routes.py @@ -0,0 +1,42 @@ +from auth import ( + AuthBearer, + get_current_user, # Assuming you have a get_current_user function +) +from fastapi import APIRouter, Depends +from models.databases.supabase.onboarding import OnboardingUpdatableProperties +from models.user_identity import UserIdentity +from repository.onboarding.get_user_onboarding import get_user_onboarding +from repository.onboarding.udpate_user_onboarding import update_user_onboarding + +onboarding_router = APIRouter() + + +@onboarding_router.get( + "/onboarding", + dependencies=[Depends(AuthBearer())], + tags=["Onboarding"], +) +async def get_user_onboarding_handler( + current_user: UserIdentity = Depends(get_current_user), +): + """ + Get user onboarding information for the current user + """ + + return get_user_onboarding(current_user.id) + + +@onboarding_router.put( + "/onboarding", + dependencies=[Depends(AuthBearer())], + tags=["Onboarding"], +) +async def update_user_onboarding_handler( + onboarding: OnboardingUpdatableProperties, + current_user: UserIdentity = Depends(get_current_user), +): + """ + Update user onboarding information for the current user + """ + + return update_user_onboarding(current_user.id, onboarding)