/opt/mawid/apps/api/src/auth
Edit: /opt/mawid/apps/api/src/auth/auth.controller.ts (911B)
import { Body, Controller, Post } from '@nestjs/common';
import { Throttle } from '@nestjs/throttler';
import {
loginSchema,
registerSchema,
type LoginInput,
type RegisterInput,
} from '@mawid/shared';
import { ZodValidationPipe } from '../common/zod-validation.pipe';
import { AuthService } from './auth.service';
import { Public } from './public.decorator';
// Brute-force protection: credential endpoints are tightly rate-limited.
@Throttle({ default: { ttl: 60_000, limit: 10 } })
@Controller('auth')
export class AuthController {
constructor(private readonly authService: AuthService) {}
@Public()
@Post('register')
register(@Body(new ZodValidationPipe(registerSchema)) body: RegisterInput) {
return this.authService.register(body);
}
@Public()
@Post('login')
login(@Body(new ZodValidationPipe(loginSchema)) body: LoginInput) {
return this.authService.login(body);
}
}