add folder operation and use createQueryRunner
This commit is contained in:
@@ -49,7 +49,6 @@ export class Perfil {
|
||||
@Column({ name: 'perfil', type: 'varchar', length: 45, nullable: false })
|
||||
perfil: string;
|
||||
|
||||
// Relación uno a muchos con usuario
|
||||
@OneToMany(() => User, (user) => user.perfil)
|
||||
usuarios: User[];
|
||||
}
|
||||
+16
-10
@@ -1,4 +1,12 @@
|
||||
import { Controller, Get, Post, Body, UseGuards, Request, Res } from '@nestjs/common';
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Body,
|
||||
UseGuards,
|
||||
Request,
|
||||
Res,
|
||||
} from '@nestjs/common';
|
||||
import type { Response } from 'express';
|
||||
import { UserService } from './user.service';
|
||||
import { CreateUserDto } from './dto/create-user.dto';
|
||||
@@ -6,19 +14,17 @@ import { AuthGuard } from '@nestjs/passport';
|
||||
|
||||
@Controller('user')
|
||||
export class UserController {
|
||||
constructor(private readonly userService: UserService) { }
|
||||
|
||||
@Post()
|
||||
async Login(@Body() data: CreateUserDto, @Res() res: Response) {
|
||||
return this.userService.Login(data, res);
|
||||
}
|
||||
constructor(private readonly userService: UserService) {}
|
||||
|
||||
@Post()
|
||||
async Login(@Body() data: CreateUserDto, @Res() res: Response) {
|
||||
return this.userService.Login(data, res);
|
||||
}
|
||||
|
||||
@UseGuards(AuthGuard('jwt'))
|
||||
@Get('/validate-token')
|
||||
getProfile(@Request() req) {
|
||||
return req.user;
|
||||
return req.user;
|
||||
}
|
||||
|
||||
}
|
||||
//IO
|
||||
//IO
|
||||
|
||||
@@ -10,7 +10,7 @@ import { JwtService } from '@nestjs/jwt';
|
||||
export class UserService {
|
||||
constructor(
|
||||
@InjectRepository(User)
|
||||
private userRepository: Repository<User>,
|
||||
private readonly userRepository: Repository<User>,
|
||||
|
||||
private jwtService: JwtService
|
||||
) { }
|
||||
|
||||
Reference in New Issue
Block a user