@nestjs/swagger#ApiMovedPermanentlyResponse TypeScript Examples

The following examples show how to use @nestjs/swagger#ApiMovedPermanentlyResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 6 votes vote down vote up
@ApiCookieAuth()
  @ApiBody({ type: SignInDto })
  @ApiMovedPermanentlyResponse({ description: 'Returns 301 if login is ok' })
  @ApiInternalServerErrorResponse({
    description: 'Returns 500 if smth has been failed',
  })
  @HttpCode(HttpStatus.MOVED_PERMANENTLY)
  @UseGuards(LocalAuthGuard)
  @Post('/login')
  @Redirect('/v1/home')
  public login(): void {}
Example #2
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 6 votes vote down vote up
@ApiMovedPermanentlyResponse({ description: 'Redirects to home' })
  @ApiInternalServerErrorResponse({ description: 'Returns the 500 error' })
  @Post('/register')
  @Redirect('/v1/auth/login')
  public async create(@Body() params: SignUpDto): Promise<void> {
    const { email, _id } = await this.usersService.create(params) as UserDocument;
    const token = await this.authService.createVerifyToken(_id);

    await this.mailerService.sendMail({
      to: email,
      from: this.configService.get<string>('MAILER_FROM_EMAIL'),
      subject: 'Email Verification',
      template: `${process.cwd()}/public/views/mailer/templates/verify-password`,
      context: {
        token,
        email,
        host: this.configService.get<number>('SERVER_HOST'),
      },
    });
  }
Example #3
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 6 votes vote down vote up
@ApiCookieAuth()
  @ApiBody({ type: SignInDto })
  @ApiMovedPermanentlyResponse({ description: 'Returns 301 if login is ok' })
  @ApiInternalServerErrorResponse({
    description: 'Returns 500 if smth has been failed',
  })
  @HttpCode(HttpStatus.MOVED_PERMANENTLY)
  @UseGuards(LocalAuthGuard)
  @Post('/login')
  @Redirect('/v1/home')
  public login(): void { }
Example #4
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 6 votes vote down vote up
@ApiMovedPermanentlyResponse({ description: 'Redirects to home' })
  @ApiInternalServerErrorResponse({ description: 'Returns the 500 error' })
  @Post('/register')
  @Redirect('/v1/auth/login')
  public async create(@Body() params: SignUpDto): Promise<void> {
    const { email, id } = await this.usersService.create(params);
    const token = await this.authService.createVerifyToken(id);
    await this.mailerService.sendMail({
      to: email,
      from: this.configService.get<string>('MAILER_FROM_EMAIL'),
      subject: 'Email Verification',
      template: `${process.cwd()}/public/views/mailer/templates/verify-password`,
      context: {
        token,
        email,
        host: this.configService.get<number>('SERVER_HOST'),
      },
    });
  }
Example #5
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 6 votes vote down vote up
@ApiCookieAuth()
  @ApiBody({ type: SignInDto })
  @ApiMovedPermanentlyResponse({ description: 'Returns 301 if login is ok' })
  @ApiInternalServerErrorResponse({
    description: 'Returns 500 if smth has been failed',
  })
  @HttpCode(HttpStatus.MOVED_PERMANENTLY)
  @UseGuards(LocalAuthGuard)
  @Post('/login')
  @Redirect('/home')
  public login(): void {}
Example #6
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiMovedPermanentlyResponse({ description: 'Does redirect to route' })
  @Get()
  @UseGuards(GoogleAuthGuard)
  async googleAuth() {}
Example #7
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiMovedPermanentlyResponse({ description: 'Redirects to home' })
  @ApiInternalServerErrorResponse({ description: 'Returns the 500 error' })
  @Post('/register')
  @Redirect('/v1/auth/login')
  public async create(@Body() params: SignUpDto): Promise<void> {
    await this.usersService.create(params);
  }
Example #8
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiMovedPermanentlyResponse({ description: '301. If logout is success' })
  @ApiInternalServerErrorResponse({ description: 'Internal error' })
  @Get('/logout')
  @Redirect('/v1/auth/login')
  public logout(@Request() req: ExpressRequest): void {
    req.logout();
  }
Example #9
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiMovedPermanentlyResponse({ description: 'Does redirect to route' })
  @Get()
  @UseGuards(GoogleAuthGuard)
  async googleAuth(@Req() req: ExpressRequest) {}
Example #10
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiMovedPermanentlyResponse({ description: '301. If logout is success' })
  @ApiInternalServerErrorResponse({ description: 'Internal error' })
  @Get('/logout')
  @Redirect('/v1/auth/login')
  public logout(@Request() req: ExpressRequest): void {
    req.logout();
  }
Example #11
Source File: auth.controller.ts    From nest-js-boilerplate with MIT License 5 votes vote down vote up
@ApiMovedPermanentlyResponse({ description: '301. If logout is success' })
  @ApiInternalServerErrorResponse({ description: 'Internal error' })
  @Get('/logout')
  @Redirect('/v1/auth/login')
  public logout(@Request() req: ExpressRequest): void {
    req.logout();
  }