fixed bug
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import { Body, Controller, Delete, Get, Param, ParseIntPipe, Post, Put } from '@nestjs/common';
|
||||
import { ProfesorService } from './profesor.service';
|
||||
import { profesorDto } from './dto/profesorDto.dto';
|
||||
import { ProfesorFilterDto } from './dto/profesorFilterDto.dto';
|
||||
|
||||
@Controller('profesor')
|
||||
export class ProfesorController {
|
||||
|
||||
@@ -26,6 +26,7 @@ export class AuthController {
|
||||
return this.authService.signIn(data);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard)
|
||||
@Post("register")
|
||||
async register(@Body() data: registerDto){
|
||||
return this.authService.register(data)
|
||||
@@ -37,12 +38,6 @@ export class AuthController {
|
||||
return req.user;
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard)
|
||||
@Post('Alta')
|
||||
async create(@Body() data: UserDto) {
|
||||
return this.authService.create(data);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard)
|
||||
@Put('Modificacion/:id')
|
||||
async update(@Param('id') id: number, @Body() updateUserDto: Record<string, any>) {
|
||||
|
||||
@@ -65,8 +65,6 @@ export class AuthService {
|
||||
return { token: token };
|
||||
}
|
||||
|
||||
async create(data) {}
|
||||
|
||||
async update(id, updateUserDto) {}
|
||||
|
||||
async remove(id) {}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import {IsString, IsNotEmpty,IsNumber } from "class-validator";
|
||||
import {IsString, IsNotEmpty,IsNumber,IsEmail } from "class-validator";
|
||||
|
||||
export class registerDto{
|
||||
|
||||
@@ -14,7 +14,7 @@ export class registerDto{
|
||||
@IsNotEmpty()
|
||||
id_tipo_usuario:number;
|
||||
|
||||
@IsString()
|
||||
@IsEmail()
|
||||
@IsNotEmpty()
|
||||
correo: string;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { IsEmail, IsNotEmpty, IsString} from "class-validator";
|
||||
import { IsEmail, IsNotEmpty, IsString,IsNumber} from "class-validator";
|
||||
|
||||
export class UserDto{
|
||||
@IsString()
|
||||
@@ -9,4 +9,12 @@ export class UserDto{
|
||||
@IsNotEmpty()
|
||||
contraseña: string;
|
||||
|
||||
@IsNumber()
|
||||
@IsNotEmpty()
|
||||
id_tipo_usuario:number;
|
||||
|
||||
@IsEmail()
|
||||
@IsNotEmpty()
|
||||
correo: string;
|
||||
|
||||
}
|
||||
@@ -19,10 +19,10 @@ export class UsersService {
|
||||
const newUser = this.users.create(user);
|
||||
return this.users.save(newUser);
|
||||
}
|
||||
//TODO Validar Esta funcion
|
||||
// async update(userId: number, updateUserDto: UserDto): Promise<User> {
|
||||
// return await this.users.update(userId, updateUserDto);
|
||||
// }
|
||||
|
||||
//async update(userId: number, updateUserDto: UserDto): Promise<User> {
|
||||
//return await this.users.update(userId, updateUserDto);
|
||||
//}
|
||||
|
||||
async remove(userId: number): Promise<void> {
|
||||
await this.users.delete(userId);
|
||||
|
||||
Reference in New Issue
Block a user