auth defined test required

This commit is contained in:
2025-07-27 15:54:23 +03:00
parent f39dc541e1
commit 6cf7ce1397
17 changed files with 857 additions and 147 deletions

View File

@@ -8,12 +8,15 @@ import {
Body,
HttpCode,
UseGuards,
Req,
} 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';
import { userCreatePasswordValidator } from './password/create/dtoValidator';
import { userChangePasswordValidator } from './password/change/dtoValidator';
@Controller('auth')
export class AuthController {
@@ -34,15 +37,18 @@ export class AuthController {
@Post('/password/create')
@HttpCode(200)
async createPassword() {
return { message: 'Password created successfully' };
async createPassword(@Body() query: userCreatePasswordValidator) {
return await this.authService.createPassword(query);
}
@Post('/password/change')
@HttpCode(200)
@UseGuards(AuthControlGuard)
async changePassword() {
return { message: 'Password changed successfully' };
async changePassword(
@Body() query: userChangePasswordValidator,
@Req() req: Request,
) {
return await this.authService.changePassword(query, req);
}
@Post('/password/reset')