Showing
7 changed files
with
37 additions
and
24 deletions
| @@ -7,7 +7,7 @@ | @@ -7,7 +7,7 @@ | ||
| 7 | "license": "UNLICENSED", | 7 | "license": "UNLICENSED", |
| 8 | "scripts": { | 8 | "scripts": { |
| 9 | "ln:build:prod": "NODE_ENV=prod && nest build", | 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 | "ln:build:local": "STAGE=local nest build", | 11 | "ln:build:local": "STAGE=local nest build", |
| 12 | "ln:start": "STAGE=dev nest start", | 12 | "ln:start": "STAGE=dev nest start", |
| 13 | "ln:start:test": "SET NODE_ENV=dev && nest start", | 13 | "ln:start:test": "SET NODE_ENV=dev && nest start", |
| @@ -2,18 +2,18 @@ import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; | @@ -2,18 +2,18 @@ import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; | ||
| 2 | import { AppController } from './app.controller'; | 2 | import { AppController } from './app.controller'; |
| 3 | import { AppService } from './app.service'; | 3 | import { AppService } from './app.service'; |
| 4 | import { UsersModule } from '../users/users.module'; | 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 | import { AuthModule } from '../auth/auth.module'; | 6 | import { AuthModule } from '../auth/auth.module'; |
| 7 | import { DescryptMiddleware } from './middlewares/decrypt.middleware'; | 7 | import { DescryptMiddleware } from './middlewares/decrypt.middleware'; |
| 8 | import { PublicModule } from '@app/public'; | 8 | import { PublicModule } from '@app/public'; |
| 9 | -import { PrivateModule } from '@app/private'; | 9 | +// import { PrivateModule } from '@app/private'; |
| 10 | import { ConfigModule } from '@nestjs/config'; | 10 | import { ConfigModule } from '@nestjs/config'; |
| 11 | import { ThrottlerModule } from '@nestjs/throttler'; | 11 | import { ThrottlerModule } from '@nestjs/throttler'; |
| 12 | 12 | ||
| 13 | @Module({ | 13 | @Module({ |
| 14 | imports: [ | 14 | imports: [ |
| 15 | PublicModule, | 15 | PublicModule, |
| 16 | - PrivateModule, | 16 | + // PrivateModule, |
| 17 | UsersModule, | 17 | UsersModule, |
| 18 | AuthModule, | 18 | AuthModule, |
| 19 | ConfigModule.forRoot({ | 19 | ConfigModule.forRoot({ |
| @@ -29,7 +29,9 @@ import { ThrottlerModule } from '@nestjs/throttler'; | @@ -29,7 +29,9 @@ import { ThrottlerModule } from '@nestjs/throttler'; | ||
| 29 | ]), | 29 | ]), |
| 30 | ], | 30 | ], |
| 31 | controllers: [AppController], | 31 | controllers: [AppController], |
| 32 | - providers: [AppService, PrismaService], | 32 | + providers: [AppService |
| 33 | + // , PrismaService | ||
| 34 | + ], | ||
| 33 | }) | 35 | }) |
| 34 | export class AppModule implements NestModule { | 36 | export class AppModule implements NestModule { |
| 35 | configure(consumer: MiddlewareConsumer) { | 37 | configure(consumer: MiddlewareConsumer) { |
| 1 | import { Controller, Request, Post, UseGuards } from '@nestjs/common'; | 1 | import { Controller, Request, Post, UseGuards } from '@nestjs/common'; |
| 2 | import { AuthService } from './auth.service'; | 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 | import { PublicApiKeyGuard } from './guards/public-api-key.guard'; | 5 | import { PublicApiKeyGuard } from './guards/public-api-key.guard'; |
| 6 | 6 | ||
| 7 | @Controller('auth') | 7 | @Controller('auth') |
| 8 | export class AuthController { | 8 | export class AuthController { |
| 9 | constructor(private readonly authService: AuthService) { } | 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 | @UseGuards(PublicApiKeyGuard) | 17 | @UseGuards(PublicApiKeyGuard) |
| 18 | @Post('public/login') | 18 | @Post('public/login') |
| @@ -7,7 +7,7 @@ import { LocalStrategy } from './strategies/local.strategy'; | @@ -7,7 +7,7 @@ import { LocalStrategy } from './strategies/local.strategy'; | ||
| 7 | import { JwtStrategy } from './strategies/private-jwt.strategy'; | 7 | import { JwtStrategy } from './strategies/private-jwt.strategy'; |
| 8 | import { UsersModule } from '../users/users.module'; | 8 | import { UsersModule } from '../users/users.module'; |
| 9 | import { UsersService } from '../users/users.service'; | 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 | import { AuthController } from './auth.controller'; | 11 | import { AuthController } from './auth.controller'; |
| 12 | 12 | ||
| 13 | @Module({ | 13 | @Module({ |
| @@ -20,6 +20,12 @@ import { AuthController } from './auth.controller'; | @@ -20,6 +20,12 @@ import { AuthController } from './auth.controller'; | ||
| 20 | }), | 20 | }), |
| 21 | ], | 21 | ], |
| 22 | controllers: [AuthController], | 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 | export class AuthModule { } | 31 | export class AuthModule { } |
| @@ -11,11 +11,11 @@ export class AuthService { | @@ -11,11 +11,11 @@ export class AuthService { | ||
| 11 | ) { } | 11 | ) { } |
| 12 | 12 | ||
| 13 | async validateUser(email: string, pass: string): Promise<any> { | 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 | return null; | 19 | return null; |
| 20 | } | 20 | } |
| 21 | 21 |
| 1 | import { Module } from '@nestjs/common'; | 1 | import { Module } from '@nestjs/common'; |
| 2 | import { UsersService } from './users.service'; | 2 | import { UsersService } from './users.service'; |
| 3 | import { UsersController } from './users.controller'; | 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 | @Module({ | 6 | @Module({ |
| 7 | imports: [], | 7 | imports: [], |
| 8 | controllers: [UsersController], | 8 | controllers: [UsersController], |
| 9 | - providers: [UsersService, PrismaService], | 9 | + providers: [UsersService |
| 10 | + // , PrismaService | ||
| 11 | + ], | ||
| 10 | }) | 12 | }) |
| 11 | export class UsersModule { } | 13 | export class UsersModule { } |
| 1 | import { Injectable } from '@nestjs/common'; | 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 | @Injectable() | 4 | @Injectable() |
| 5 | export class UsersService { | 5 | export class UsersService { |
| 6 | - constructor(private prisma: PrismaService) { } | 6 | + constructor( |
| 7 | + // private prisma: PrismaService | ||
| 8 | + ) { } | ||
| 7 | create() { } | 9 | create() { } |
| 8 | 10 | ||
| 9 | findAll() { | 11 | findAll() { |
| @@ -20,6 +22,7 @@ export class UsersService { | @@ -20,6 +22,7 @@ export class UsersService { | ||
| 20 | } | 22 | } |
| 21 | 23 | ||
| 22 | findByMail(email: string) { | 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