You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
import { Body, Controller, Patch, Request, UseGuards } from '@nestjs/common';
|
|
|
|
import { UsersService } from './users.service';
|
|
|
|
import { ChangePasswordDto } from './dto/change-password.dto';
|
|
|
|
import { JwtAuthGuard } from 'src/auth/jwt-auth.guard';
|
|
|
|
import { SuccessResponseDto } from 'src/common/dto/sucees-response.dto';
|
|
|
|
import { AuthRequest } from 'src/common/interfaces/auth-request.interface';
|
|
|
|
|
|
|
|
@Controller('users')
|
|
|
|
export class UsersController {
|
|
|
|
constructor(private readonly userService: UsersService) {}
|
|
|
|
|
|
|
|
@UseGuards(JwtAuthGuard)
|
|
|
|
@Patch('password')
|
|
|
|
async changePassword(
|
|
|
|
@Request() req: AuthRequest,
|
|
|
|
@Body() dto: ChangePasswordDto,
|
|
|
|
): Promise<SuccessResponseDto> {
|
|
|
|
await this.userService.changePassword(req.user.userId, dto);
|
|
|
|
return SuccessResponseDto.ok();
|
|
|
|
}
|
|
|
|
}
|