forked from Yara724/api
22 lines
629 B
TypeScript
22 lines
629 B
TypeScript
import { Body, Controller, Post } from "@nestjs/common";
|
|
import { Public } from "./decorators";
|
|
import { UserLoginDto, UserRegisterDto } from "./dtos";
|
|
import { AuthService } from "./auth.service";
|
|
|
|
@Controller("auth")
|
|
export class AuthController {
|
|
constructor(private readonly authService: AuthService) {}
|
|
|
|
@Public()
|
|
@Post("user/register")
|
|
async register(@Body() userRegisterDto: UserRegisterDto) {
|
|
return await this.authService.registerUser(userRegisterDto);
|
|
}
|
|
|
|
@Public()
|
|
@Post("user/login")
|
|
async login(@Body() userLoginDto: UserLoginDto) {
|
|
return await this.authService.loginUser(userLoginDto);
|
|
}
|
|
}
|