2424 UploadFile ,
2525)
2626from fastapi .concurrency import run_in_threadpool
27- from prisma .models import UserOnboarding
2827from pydantic import BaseModel
2928from starlette .status import HTTP_204_NO_CONTENT , HTTP_404_NOT_FOUND
3029from typing_extensions import Optional , TypedDict
@@ -119,6 +118,25 @@ def _create_file_size_error(size_bytes: int, max_size_mb: int) -> HTTPException:
119118logger = logging .getLogger (__name__ )
120119
121120
121+ # Needed to avoid including User from UserOnboarding prisma model in router
122+ # that causes schema generation for prisma and our LibraryAgent in openapi.json
123+ class UserOnboarding (pydantic .BaseModel ):
124+ userId : str
125+ completedSteps : list [OnboardingStep ]
126+ walletShown : bool
127+ notified : list [OnboardingStep ]
128+ rewardedFor : list [OnboardingStep ]
129+ usageReason : Optional [str ]
130+ integrations : list [str ]
131+ otherIntegrations : Optional [str ]
132+ selectedStoreListingVersionId : Optional [str ]
133+ agentInput : dict [str , Any ]
134+ onboardingAgentExecutionId : Optional [str ]
135+ agentRuns : int
136+ lastRunAt : Optional [datetime ]
137+ consecutiveRunDays : int
138+
139+
122140async def hide_activity_summaries_if_disabled (
123141 executions : list [execution_db .GraphExecutionMeta ], user_id : str
124142) -> list [execution_db .GraphExecutionMeta ]:
@@ -263,10 +281,9 @@ async def update_preferences(
263281 summary = "Onboarding state" ,
264282 tags = ["onboarding" ],
265283 dependencies = [Security (requires_user )],
284+ response_model = UserOnboarding ,
266285)
267- async def get_onboarding (
268- user_id : Annotated [str , Security (get_user_id )]
269- ) -> UserOnboarding :
286+ async def get_onboarding (user_id : Annotated [str , Security (get_user_id )]):
270287 return await get_user_onboarding (user_id )
271288
272289
@@ -275,10 +292,11 @@ async def get_onboarding(
275292 summary = "Update onboarding state" ,
276293 tags = ["onboarding" ],
277294 dependencies = [Security (requires_user )],
295+ response_model = UserOnboarding ,
278296)
279297async def update_onboarding (
280298 user_id : Annotated [str , Security (get_user_id )], data : UserOnboardingUpdate
281- ) -> UserOnboarding :
299+ ):
282300 return await update_user_onboarding (user_id , data )
283301
284302
@@ -323,10 +341,9 @@ async def is_onboarding_enabled() -> bool:
323341 summary = "Reset onboarding progress" ,
324342 tags = ["onboarding" ],
325343 dependencies = [Security (requires_user )],
344+ response_model = UserOnboarding ,
326345)
327- async def reset_onboarding (
328- user_id : Annotated [str , Security (get_user_id )]
329- ) -> UserOnboarding :
346+ async def reset_onboarding (user_id : Annotated [str , Security (get_user_id )]):
330347 return await reset_user_onboarding (user_id )
331348
332349
0 commit comments