All files / src/platform/registration registration.controller.ts

0% Statements 0/23
0% Branches 0/8
0% Functions 0/8
0% Lines 0/19

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 57 58 59 60 61 62 63 64 65 66 67 68 69 70                                                                                                                                           
import {
  Controller,
  Get,
  Post,
  Body,
  Query,
  Req,
  UseGuards,
} from '@nestjs/common';
import { CompanyRegistrationService } from './registration.service';
import { ApiTags, ApiOperation, ApiResponse } from '@nestjs/swagger';
 
@Controller('api/v1/public/register')
@ApiTags('PublicRegistration')
export class PublicRegistrationController {
  constructor(
    private readonly registrationService: CompanyRegistrationService,
  ) {}
 
  @Post('company')
  @ApiOperation({ summary: 'Register operation' })
  @ApiResponse({ status: 201, description: 'Operation successful' })
  async register(@Body() body: any) {
    return this.registrationService.registerCompany(body);
  }
 
  @Post('check-email')
  @ApiOperation({ summary: 'Check email operation' })
  @ApiResponse({ status: 201, description: 'Operation successful' })
  async checkEmail(@Body() body: { email: string }) {
    return this.registrationService.checkEmail(body.email);
  }
 
  @Post('check-subdomain')
  @ApiOperation({ summary: 'Check subdomain operation' })
  @ApiResponse({ status: 201, description: 'Operation successful' })
  async checkSubdomain(@Body() body: { subdomain: string }) {
    return this.registrationService.checkSubdomain(body.subdomain);
  }
}
 
@Controller('api/v1/auth')
@ApiTags('AccountActivation')
export class AccountActivationController {
  constructor(
    private readonly registrationService: CompanyRegistrationService,
  ) {}
 
  @Post('verify-email')
  @ApiOperation({ summary: 'Verify operation' })
  @ApiResponse({ status: 201, description: 'Operation successful' })
  async verify(@Body() body: { token: string }) {
    return this.registrationService.verifyEmail(body.token);
  }
 
  @Post('resend-verification')
  @ApiOperation({ summary: 'Resend operation' })
  @ApiResponse({ status: 201, description: 'Operation successful' })
  async resend(@Body() body: { email: string }) {
    return this.registrationService.resendVerification(body.email);
  }
 
  @Get('verification-status')
  @ApiOperation({ summary: 'Get status operation' })
  @ApiResponse({ status: 200, description: 'Operation successful' })
  async getStatus(@Query('userId') userId: string) {
    return this.registrationService.getVerificationStatus(userId);
  }
}