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.
tryFullStack/backend/src/users/users.controller.ts

18 lines
725 B

2 months ago
import { Body, Controller, Patch, Request, UseGuards } from '@nestjs/common';
2 months ago
import { UsersService } from './users.service';
import { ChangePasswordDto } from './dto/change-password.dto';
2 months ago
import { JwtAuthGuard } from 'src/auth/jwt-auth.guard';
import { SuccessResponseDto } from 'src/common/dto/sucees-response.dto';
2 months ago
@Controller('users')
export class UsersController {
constructor(private readonly userService: UsersService) {}
2 months ago
@UseGuards(JwtAuthGuard)
2 months ago
@Patch('password')
2 months ago
async changePassword(@Request() req, @Body() dto: ChangePasswordDto): Promise<SuccessResponseDto> {
2 months ago
await this.userService.changePassword(req.user.userId, dto);
2 months ago
return SuccessResponseDto.ok();
2 months ago
}
}