Files
HealthCarePregnant/pcm-platform/backend/src/modules/auth/auth.controller.ts
T
2026-06-18 09:48:05 +08:00

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);
}
}