2024-06-06 20:32:46 -06:00
|
|
|
import {
|
|
|
|
|
Body,
|
|
|
|
|
Controller,
|
|
|
|
|
Get,
|
|
|
|
|
HttpCode,
|
|
|
|
|
HttpStatus,
|
|
|
|
|
Post,
|
|
|
|
|
Request,
|
|
|
|
|
UseGuards
|
|
|
|
|
} from '@nestjs/common';
|
|
|
|
|
import { AuthGuard } from './auth.guard';
|
2024-06-05 14:35:05 -06:00
|
|
|
import { AuthService } from './auth.service';
|
|
|
|
|
|
|
|
|
|
@Controller('auth')
|
|
|
|
|
export class AuthController {
|
|
|
|
|
constructor(private authService: AuthService) {}
|
|
|
|
|
|
|
|
|
|
@HttpCode(HttpStatus.OK)
|
|
|
|
|
@Post('login')
|
|
|
|
|
signIn(@Body() signInDto: Record<string, any>) {
|
|
|
|
|
return this.authService.signIn(signInDto.username, signInDto.password);
|
|
|
|
|
}
|
2024-06-06 20:32:46 -06:00
|
|
|
|
|
|
|
|
@UseGuards(AuthGuard)
|
|
|
|
|
@Get('profile')
|
|
|
|
|
getProfile(@Request() req) {
|
|
|
|
|
return req.user;
|
|
|
|
|
}
|
|
|
|
|
}
|