sto-k-odnomu/backend/src/auth/auth.controller.ts
2026-01-03 17:07:04 +03:00

22 lines
672 B
TypeScript

import { Controller, Post, Body } from '@nestjs/common';
import { AuthService } from './auth.service';
@Controller('auth')
export class AuthController {
constructor(private authService: AuthService) {}
@Post('anonymous')
async createAnonymous(@Body('name') name?: string) {
return this.authService.createAnonymousUser(name);
}
@Post('register')
async register(@Body() dto: { email: string; password: string; name: string }) {
return this.authService.register(dto.email, dto.password, dto.name);
}
@Post('login')
async login(@Body() dto: { email: string; password: string }) {
return this.authService.login(dto.email, dto.password);
}
}