added alumno_inscrito and others Ep

This commit is contained in:
2025-09-24 11:04:08 -04:00
parent c39faa513b
commit 86ccf98479
16 changed files with 230 additions and 23 deletions
+13 -3
View File
@@ -6,15 +6,17 @@ import {
UseGuards,
Request,
Res,
Req,
} from '@nestjs/common';
import type { Response } from 'express';
import { UserService } from './user.service';
import { CreateUserDto } from './dto/create-user.dto';
import { changePasswordDto, CreateUserDto } from './dto/create-user.dto';
import { AuthGuard } from '@nestjs/passport';
import { JwtAuthGuard } from './jwt.guard';
@Controller('user')
export class UserController {
constructor(private readonly userService: UserService) {}
constructor(private readonly userService: UserService) { }
@Post()
async Login(@Body() data: CreateUserDto, @Res() res: Response) {
@@ -23,8 +25,16 @@ export class UserController {
@UseGuards(AuthGuard('jwt'))
@Get('/validate-token')
getProfile(@Request() req) {
getProfile(@Req() req) {
return req.user;
}
@UseGuards(JwtAuthGuard)
@Post('/change-password')
async changePassword(@Body() data: changePasswordDto, @Req() req) {
const id_usuario = req.user.id;
await this.userService.changePassword(data, id_usuario);
return { message: 'Contraseña actualizada correctamente' };
}
}
//IO