mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-21 12:11:02 +10:00
27 lines
649 B
TypeScript
27 lines
649 B
TypeScript
import {
|
|
Body,
|
|
Controller,
|
|
Get,
|
|
HttpCode,
|
|
HttpStatus,
|
|
Post,
|
|
} from '@nestjs/common';
|
|
import { LoginDto } from './dto/login.dto';
|
|
import { AuthService } from './services/auth.service';
|
|
import { CreateUserDto } from '../user/dto/create-user.dto';
|
|
|
|
@Controller('auth')
|
|
export class AuthController {
|
|
constructor(private authService: AuthService) {}
|
|
@HttpCode(HttpStatus.OK)
|
|
@Post('login')
|
|
async login(@Body() loginInput: LoginDto) {
|
|
return await this.authService.login(loginInput);
|
|
}
|
|
|
|
@Post('register')
|
|
async register(@Body() createUserDto: CreateUserDto) {
|
|
return await this.authService.register(createUserDto);
|
|
}
|
|
}
|