auth module controllers carried
This commit is contained in:
74
ServicesApi/src/auth/auth.controller.ts
Normal file
74
ServicesApi/src/auth/auth.controller.ts
Normal file
@@ -0,0 +1,74 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Put,
|
||||
Delete,
|
||||
Param,
|
||||
Body,
|
||||
HttpCode,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { AuthService } from './auth.service';
|
||||
import { userLoginValidator } from './login/dtoValidator';
|
||||
import { userSelectValidator } from './select/dtoValidator';
|
||||
import { userLogoutValidator } from './logout/dtoValidator';
|
||||
import { AuthControlGuard } from '../middleware/access-control.guard';
|
||||
|
||||
@Controller('auth')
|
||||
export class AuthController {
|
||||
constructor(private readonly authService: AuthService) {}
|
||||
|
||||
@Post('login')
|
||||
@HttpCode(200)
|
||||
async login(@Body() query: userLoginValidator) {
|
||||
return await this.authService.login(query);
|
||||
}
|
||||
|
||||
@Post('select')
|
||||
@HttpCode(200)
|
||||
@UseGuards(AuthControlGuard)
|
||||
async select(@Body() query: userSelectValidator) {
|
||||
return { message: 'Logout successful' };
|
||||
}
|
||||
|
||||
@Post('/password/create')
|
||||
@HttpCode(200)
|
||||
async createPassword() {
|
||||
return { message: 'Password created successfully' };
|
||||
}
|
||||
|
||||
@Post('/password/change')
|
||||
@HttpCode(200)
|
||||
@UseGuards(AuthControlGuard)
|
||||
async changePassword() {
|
||||
return { message: 'Password changed successfully' };
|
||||
}
|
||||
|
||||
@Post('/password/reset')
|
||||
@HttpCode(200)
|
||||
async resetPassword() {
|
||||
return { message: 'Password reset successfully' };
|
||||
}
|
||||
|
||||
@Post('/password/verify-otp')
|
||||
@HttpCode(200)
|
||||
@UseGuards(AuthControlGuard)
|
||||
async verifyOtp() {
|
||||
return { message: 'Password verified successfully' };
|
||||
}
|
||||
|
||||
@Post('logout')
|
||||
@HttpCode(200)
|
||||
@UseGuards(AuthControlGuard)
|
||||
async logout(@Body() query: userLogoutValidator) {
|
||||
return { message: 'Logout successful' };
|
||||
}
|
||||
|
||||
@Post('disconnect')
|
||||
@HttpCode(200)
|
||||
@UseGuards(AuthControlGuard)
|
||||
async disconnect() {
|
||||
return { message: 'Disconnect successful' };
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user