import { Controller , Post , UseGuards , Request } from '@nestjs/common' ; import { AuthService } from './auth.service' ; import { ApiBody , ApiTags } from '@nestjs/swagger' ; import { LocalAuthGuard } from './guards/local-auth.guard' ; import { SkipJwtAuth } from './constants' ; import { LoginDto } from './dto/LoginDto' ; @ ApiTags ( '登录验证' ) @ Controller ( 'auth' ) export class AuthController { constructor ( private authService ) { } @ ApiBody ( { type : LoginDto } ) @ SkipJwtAuth ( ) @ UseGuards ( LocalAuthGuard ) @ Post ( 'login' ) async login ( @ Request ( ) req ) { return this . authService . login ( req . user ) ; } }