Commit 13014794f3c08a7d4563525454a72e92cd15f134

Authored by Angel Caceres
1 parent f63bff38

fix: prisma problem

... ... @@ -7,7 +7,7 @@
7 7 "license": "UNLICENSED",
8 8 "scripts": {
9 9 "ln:build:prod": "NODE_ENV=prod && nest build",
10   - "ln:build:dev": "SET NODE_ENV=dev && nest build",
  10 + "ln:build:dev": "NODE_ENV=dev && nest build",
11 11 "ln:build:local": "STAGE=local nest build",
12 12 "ln:start": "STAGE=dev nest start",
13 13 "ln:start:test": "SET NODE_ENV=dev && nest start",
... ...
... ... @@ -2,18 +2,18 @@ import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common';
2 2 import { AppController } from './app.controller';
3 3 import { AppService } from './app.service';
4 4 import { UsersModule } from '../users/users.module';
5   -import { PrismaService } from 'libs/private-api/config/prisma.service';
  5 +// import { PrismaService } from 'libs/private-api/config/prisma.service';
6 6 import { AuthModule } from '../auth/auth.module';
7 7 import { DescryptMiddleware } from './middlewares/decrypt.middleware';
8 8 import { PublicModule } from '@app/public';
9   -import { PrivateModule } from '@app/private';
  9 +// import { PrivateModule } from '@app/private';
10 10 import { ConfigModule } from '@nestjs/config';
11 11 import { ThrottlerModule } from '@nestjs/throttler';
12 12
13 13 @Module({
14 14 imports: [
15 15 PublicModule,
16   - PrivateModule,
  16 + // PrivateModule,
17 17 UsersModule,
18 18 AuthModule,
19 19 ConfigModule.forRoot({
... ... @@ -29,7 +29,9 @@ import { ThrottlerModule } from '@nestjs/throttler';
29 29 ]),
30 30 ],
31 31 controllers: [AppController],
32   - providers: [AppService, PrismaService],
  32 + providers: [AppService
  33 + // , PrismaService
  34 + ],
33 35 })
34 36 export class AppModule implements NestModule {
35 37 configure(consumer: MiddlewareConsumer) {
... ...
1 1 import { Controller, Request, Post, UseGuards } from '@nestjs/common';
2 2 import { AuthService } from './auth.service';
3   -import { AuthGuard } from '@nestjs/passport';
4   -import { clientEncryptBody, privateEncryptBody } from 'src/helpers/encryptor.helper';
  3 +// import { AuthGuard } from '@nestjs/passport';
  4 +import { clientEncryptBody } from 'src/helpers/encryptor.helper';
5 5 import { PublicApiKeyGuard } from './guards/public-api-key.guard';
6 6
7 7 @Controller('auth')
8 8 export class AuthController {
9 9 constructor(private readonly authService: AuthService) { }
10 10
11   - @UseGuards(AuthGuard('local'))
12   - @Post('login')
13   - async privateLogin(@Request() req) {
14   - return privateEncryptBody(await this.authService.privateLogin(req.user));
15   - }
  11 + // @UseGuards(AuthGuard('local'))
  12 + // @Post('login')
  13 + // async privateLogin(@Request() req) {
  14 + // return privateEncryptBody(await this.authService.privateLogin(req.user));
  15 + // }
16 16
17 17 @UseGuards(PublicApiKeyGuard)
18 18 @Post('public/login')
... ...
... ... @@ -7,7 +7,7 @@ import { LocalStrategy } from './strategies/local.strategy';
7 7 import { JwtStrategy } from './strategies/private-jwt.strategy';
8 8 import { UsersModule } from '../users/users.module';
9 9 import { UsersService } from '../users/users.service';
10   -import { PrismaService } from 'libs/private-api/config/prisma.service';
  10 +// import { PrismaService } from 'libs/private-api/config/prisma.service';
11 11 import { AuthController } from './auth.controller';
12 12
13 13 @Module({
... ... @@ -20,6 +20,12 @@ import { AuthController } from './auth.controller';
20 20 }),
21 21 ],
22 22 controllers: [AuthController],
23   - providers: [AuthService, UsersService, PrismaService, LocalStrategy, JwtStrategy],
  23 + providers: [
  24 + AuthService,
  25 + UsersService,
  26 + // , PrismaService,
  27 + // LocalStrategy,
  28 + JwtStrategy,
  29 + ],
24 30 })
25 31 export class AuthModule { }
... ...
... ... @@ -11,11 +11,11 @@ export class AuthService {
11 11 ) { }
12 12
13 13 async validateUser(email: string, pass: string): Promise<any> {
14   - const user = await this.userService.findByMail(email);
15   - if (bcrypt.compareSync(pass, String(user.userPassword))) {
16   - const { ...result } = user;
17   - return result;
18   - }
  14 + // const user = await this.userService.findByMail(email);
  15 + // if (bcrypt.compareSync(pass, String(user.userPassword))) {
  16 + // const { ...result } = user;
  17 + // return result;
  18 + // }
19 19 return null;
20 20 }
21 21
... ...
1 1 import { Module } from '@nestjs/common';
2 2 import { UsersService } from './users.service';
3 3 import { UsersController } from './users.controller';
4   -import { PrismaService } from 'libs/private-api/config/prisma.service';
  4 +// import { PrismaService } from 'libs/private-api/config/prisma.service';
5 5
6 6 @Module({
7 7 imports: [],
8 8 controllers: [UsersController],
9   - providers: [UsersService, PrismaService],
  9 + providers: [UsersService
  10 + // , PrismaService
  11 + ],
10 12 })
11 13 export class UsersModule { }
... ...
1 1 import { Injectable } from '@nestjs/common';
2   -import { PrismaService } from 'libs/private-api/config/prisma.service';
  2 +// import { PrismaService } from 'libs/private-api/config/prisma.service';
3 3
4 4 @Injectable()
5 5 export class UsersService {
6   - constructor(private prisma: PrismaService) { }
  6 + constructor(
  7 + // private prisma: PrismaService
  8 + ) { }
7 9 create() { }
8 10
9 11 findAll() {
... ... @@ -20,6 +22,7 @@ export class UsersService {
20 22 }
21 23
22 24 findByMail(email: string) {
23   - return this.prisma.brUser.findFirstOrThrow({ where: { userUsername: email } });
  25 + return null
  26 + // this.prisma.brUser.findFirstOrThrow({ where: { userUsername: email } });
24 27 }
25 28 }
... ...
Please register or login to post a comment