import { Body, Controller, HttpCode, HttpStatus, Post, SerializeOptions, } from '@nestjs/common'; import { ApiTags } from '@nestjs/swagger'; import { AuthService } from '../auth/auth.service'; import { AuthTwitterService } from './auth-twitter.service'; import { AuthTwitterLoginDto } from './dto/auth-twitter-login.dto'; import { LoginResponseType } from '../auth/types/login-response.type'; @ApiTags('Auth') @Controller({ path: 'auth/twitter', version: '1', }) export class AuthTwitterController { constructor( private readonly authService: AuthService, private readonly authTwitterService: AuthTwitterService, ) {} @SerializeOptions({ groups: ['me'], }) @Post('login') @HttpCode(HttpStatus.OK) async login( @Body() loginDto: AuthTwitterLoginDto, ): Promise { const socialData = await this.authTwitterService.getProfileByToken(loginDto); return this.authService.validateSocialLogin('twitter', socialData); } }