Spaces:
Sleeping
Sleeping
Download src/modules/onboarding/onboarding.controller.ts from mahrooshishaq/SmartfolioBackend: direct link, hf CLI and curl.
- Browser
- Download file 3.15 kB
-
https://huggingface.co/spaces/mahrooshishaq/SmartfolioBackend/resolve/main/src/modules/onboarding/onboarding.controller.ts
- Command line
-
hf download hf://spaces/mahrooshishaq/SmartfolioBackend/src/modules/onboarding/onboarding.controller.ts
-
curl -L -o onboarding.controller.ts https://huggingface.co/spaces/mahrooshishaq/SmartfolioBackend/resolve/main/src/modules/onboarding/onboarding.controller.ts
3.15 kB
| import { | |
| Controller, | |
| Post, | |
| Put, | |
| Get, | |
| Body, | |
| UseGuards, | |
| Req, | |
| HttpCode, | |
| HttpStatus, | |
| } from '@nestjs/common'; | |
| import { | |
| ApiTags, | |
| ApiBearerAuth, | |
| ApiOperation, | |
| ApiOkResponse, | |
| ApiCreatedResponse, | |
| ApiUnauthorizedResponse, | |
| } from '@nestjs/swagger'; | |
| import { OnboardingService } from './onboarding.service'; | |
| import { OnboardingDto, UpdateProfileDto, UserContextDto } from '../../common/dto/onboarding.dto'; | |
| import { JwtAuthGuard } from '../auth/jwt-auth.guard'; | |
| import { AuthenticatedRequest } from '../../common/interfaces/authenticated-request.interface'; | |
| ('Onboarding') | |
| () | |
| ({ description: 'Missing or invalid JWT token' }) | |
| ('onboarding') | |
| (JwtAuthGuard) | |
| export class OnboardingController { | |
| constructor(private readonly onboardingService: OnboardingService) {} | |
| ('complete') | |
| (HttpStatus.CREATED) | |
| ({ | |
| summary: 'Complete initial onboarding', | |
| description: 'Submit career goals, experience level, education and industry. Must be called before resume analysis to personalize AI scoring.', | |
| }) | |
| ({ description: 'Onboarding saved successfully' }) | |
| async completeOnboarding( | |
| () req: AuthenticatedRequest, | |
| () onboardingDto: OnboardingDto, | |
| ): Promise<{ message: string; userContext: UserContextDto }> { | |
| const userContext = await this.onboardingService.completeOnboarding( | |
| req.user.id, | |
| onboardingDto, | |
| ); | |
| return { | |
| message: 'Onboarding completed successfully', | |
| userContext, | |
| }; | |
| } | |
| ('profile') | |
| ({ | |
| summary: 'Update career profile', | |
| description: 'Update any profile fields (role, location, skills, bio, etc.) after initial onboarding.', | |
| }) | |
| ({ description: 'Profile updated successfully' }) | |
| async updateProfile( | |
| () req: AuthenticatedRequest, | |
| () updateDto: UpdateProfileDto, | |
| ): Promise<{ message: string; userContext: UserContextDto }> { | |
| const userContext = await this.onboardingService.updateProfile( | |
| req.user.id, | |
| updateDto, | |
| ); | |
| return { | |
| message: 'Profile updated successfully', | |
| userContext, | |
| }; | |
| } | |
| ('context') | |
| ({ | |
| summary: 'Get user context snapshot', | |
| description: 'Returns a structured summary of the user\'s career profile used internally by the LLM for personalized analysis.', | |
| }) | |
| ({ description: 'User context returned' }) | |
| async getUserContext( | |
| () req: AuthenticatedRequest, | |
| ): Promise<UserContextDto> { | |
| return this.onboardingService.getUserContext(req.user.id); | |
| } | |
| ('status') | |
| ({ | |
| summary: 'Check onboarding completion status', | |
| description: 'Returns whether the user has completed initial onboarding. Frontend uses this to redirect new users.', | |
| }) | |
| ({ description: '{ completed: boolean }' }) | |
| async getOnboardingStatus( | |
| () req: AuthenticatedRequest, | |
| ): Promise<{ completed: boolean }> { | |
| const completed = await this.onboardingService.hasCompletedOnboarding( | |
| req.user.id, | |
| ); | |
| return { completed }; | |
| } | |
| } | |