eab91174db
Co-Authored-By: Claude <noreply@anthropic.com>
21 lines
628 B
TypeScript
21 lines
628 B
TypeScript
import { Body, Controller, Post } from '@nestjs/common';
|
|
import { AuthService, RegisterInput } from './auth.service';
|
|
import { AuthResult } from './auth.types';
|
|
import { Public } from '../../common/auth/public.decorator';
|
|
|
|
@Public()
|
|
@Controller('auth')
|
|
export class AuthController {
|
|
constructor(private readonly auth: AuthService) {}
|
|
|
|
@Post('register')
|
|
register(@Body() body: RegisterInput): Promise<AuthResult> {
|
|
return this.auth.register(body);
|
|
}
|
|
|
|
@Post('login')
|
|
login(@Body() body: { username: string; password: string }): Promise<AuthResult> {
|
|
return this.auth.login(body.username, body.password);
|
|
}
|
|
}
|