# Code coverage report for modules/onboarding/onboarding.controller.ts

# All files / modules/onboarding onboarding.controller.ts

0% Statements 0/14
100% Branches 0/0
0% Functions 0/3
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56

     import {
      Controller,
      Get,
      Post,
      UseGuards,
      HttpCode,
      HttpStatus,
    } from '@nestjs/common';
    import {
      ApiTags,
      ApiOperation,
      ApiResponse,
      ApiBearerAuth,
    } from '@nestjs/swagger';
    import { OnboardingService } from './onboarding.service';
    import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
    import { CurrentUser } from '../auth/decorators/current-user.decorator';
    import { RequestUser } from '../auth/strategies/jwt.strategy';
    import { OnboardingStatusDto, CompleteOnboardingResponseDto } from './dto';

    @ApiTags('onboarding')
    @Controller('onboarding')
    @UseGuards(JwtAuthGuard)
    @ApiBearerAuth()
    export class OnboardingController {
      constructor(private readonly onboardingService: OnboardingService) {}

      @Get('status')
      @ApiOperation({ summary: 'Get onboarding status for current tenant' })
      @ApiResponse({
        status: 200,
        description: 'Current onboarding status',
        type: OnboardingStatusDto,
      })
      @ApiResponse({ status: 401, description: 'Unauthorized' })
      async getStatus(@CurrentUser() user: RequestUser): Promise<OnboardingStatusDto> {
        return this.onboardingService.getStatus(user.tenant_id);
      }

      @Post('complete')
      @HttpCode(HttpStatus.OK)
      @ApiOperation({ summary: 'Complete the onboarding process' })
      @ApiResponse({
        status: 200,
        description: 'Onboarding completed successfully',
        type: CompleteOnboardingResponseDto,
      })
      @ApiResponse({ status: 400, description: 'Bad request - Invalid tenant state' })
      @ApiResponse({ status: 401, description: 'Unauthorized' })
      async completeOnboarding(
        @CurrentUser() user: RequestUser,
      ): Promise<CompleteOnboardingResponseDto> {
        return this.onboardingService.completeOnboarding(user.tenant_id, user.id);
      }
    }