27 lines
581 B
TypeScript
27 lines
581 B
TypeScript
|
import {
|
||
|
Body,
|
||
|
ClassSerializerInterceptor,
|
||
|
Controller,
|
||
|
Inject,
|
||
|
Post,
|
||
|
UseInterceptors,
|
||
|
} from '@nestjs/common';
|
||
|
import { ClientProxy } from '@nestjs/microservices';
|
||
|
import { ApiTags } from '@nestjs/swagger';
|
||
|
import { LoginDto } from './dtos/login.dto';
|
||
|
|
||
|
@Controller({
|
||
|
version: '1',
|
||
|
path: 'auth',
|
||
|
})
|
||
|
@ApiTags('Auth')
|
||
|
@UseInterceptors(ClassSerializerInterceptor)
|
||
|
export class AuthController {
|
||
|
constructor(@Inject('auth') private auth: ClientProxy) {}
|
||
|
|
||
|
@Post('login')
|
||
|
async login(@Body() body: LoginDto) {
|
||
|
return this.auth.send('auth.login', { body });
|
||
|
}
|
||
|
}
|