import { Controller, Get, Patch, Body, UseGuards, Request, BadRequestException } from '@nestjs/common'; import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger'; import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard'; import { AllowViewer } from '../../common/decorators/allow-viewer.decorator'; import { OnboardingService } from './onboarding.service'; @ApiTags('onboarding') @Controller('onboarding') @ApiBearerAuth() @UseGuards(JwtAuthGuard) export class OnboardingController { constructor(private onboardingService: OnboardingService) {} @Get('progress') @ApiOperation({ summary: 'Get onboarding progress for current org' }) @AllowViewer() async getProgress(@Request() req: any) { const orgId = req.user.orgId; if (!orgId) throw new BadRequestException('No organization context'); return this.onboardingService.getProgress(orgId); } @Patch('progress') @ApiOperation({ summary: 'Mark an onboarding step as complete' }) async markStep(@Request() req: any, @Body() body: { step: string }) { const orgId = req.user.orgId; if (!orgId) throw new BadRequestException('No organization context'); if (!body.step) throw new BadRequestException('step is required'); return this.onboardingService.markStepComplete(orgId, body.step); } }