Spaces:
Sleeping
Sleeping
import { | |
Body, | |
Controller, | |
Get, | |
HttpCode, | |
HttpStatus, | |
Post, | |
Request, | |
} from '@nestjs/common'; | |
import { AuthenticationService } from './authentication.service.js'; | |
import { Public } from './authentication.decorator.js'; | |
import { SignInDto } from './dto/sign-in.dto.js'; | |
import { SignUpDto } from './dto/sign-up.dto.js'; | |
import { Roles } from './authorization/roles.decorator.js'; | |
import { Role } from '../../common/enums/role.enum.js'; | |
'authentication') | (|
export class AuthenticationController { | |
constructor(private AuthenticationService: AuthenticationService) {} | |
() | |
HttpStatus.OK) | (|
'login') | (|
signIn() { () signInDto: SignInDto | |
return this.AuthenticationService.signIn(signInDto.username, signInDto.password); | |
} | |
() | |
HttpStatus.OK) | (|
'signup') | (|
signUp() { () signUpDto: SignUpDto | |
return this.AuthenticationService.signUp(signUpDto); | |
} | |
'profile') | (|
getProfile() { () req | |
const userId = req.user.sub; | |
return this.AuthenticationService.getProfile(userId); | |
} | |
} | |