import { Controller, Get, Post, Body, UseGuards, HttpCode } from '@nestjs/common' import { AuthService } from './auth.service' import { LoginDto, RegisterDto, RefreshDto } from './dto/login.dto' import { JwtAuthGuard } from '../../common/guards/jwt-auth.guard' import { CurrentUser } from '../../common/decorators/current-user.decorator' @Controller('auth') export class AuthController { constructor(private readonly authService: AuthService) {} @Post('register') register(@Body() dto: RegisterDto) { return this.authService.register(dto) } @Post('login') @HttpCode(200) login(@Body() dto: LoginDto) { return this.authService.login(dto) } @Post('refresh') @HttpCode(200) refresh(@Body() dto: RefreshDto) { return this.authService.refresh(dto.refreshToken) } @Post('logout') @HttpCode(200) @UseGuards(JwtAuthGuard) logout(@Body() dto: RefreshDto) { return this.authService.logout(dto.refreshToken) } @Get('me') @UseGuards(JwtAuthGuard) me(@CurrentUser() user: { userId: string }) { return this.authService.getCurrentUser(user.userId) } @Get('health') health() { return { status: 'ok', phase: 'phase-2-auth' } } }