Skip to content

Commit

Permalink
'.'
Browse files Browse the repository at this point in the history
  • Loading branch information
ManucherKM committed Sep 21, 2023
1 parent 36a4a09 commit 043443c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/google-user/google-user.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { JwtAuthGuard } from '@/jwt/guards/jwt-auth.guard'
import { JwtAuthGuard } from '@/guard/jwt-auth.guard'
import {
Body,
Controller,
Expand Down
1 change: 0 additions & 1 deletion src/google-user/google-user.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { GoogleUserService } from './google-user.service'
MongooseModule.forFeature([
{ name: GoogleUser.name, schema: GoogleUserSchema },
]),
forwardRef(() => JwtModule),
],
controllers: [GoogleUserController],
providers: [GoogleUserService],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { JwtService } from '@/jwt/jwt.service'
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common'
import {
CanActivate,
ExecutionContext,
Inject,
Injectable,
} from '@nestjs/common'
import { Request } from 'express'

@Injectable()
export class JwtAuthGuard implements CanActivate {
constructor(private readonly jwtService: JwtService) {}
constructor(@Inject(JwtService) private readonly jwtService: JwtService) {}

async canActivate(context: ExecutionContext): Promise<boolean> {
const req: Request = context.switchToHttp().getRequest()
Expand Down
7 changes: 3 additions & 4 deletions src/jwt/jwt.module.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
import { GoogleUserModule } from '@/google-user/google-user.module'
import { UserModule } from '@/user/user.module'
import { VkUserModule } from '@/vk-user/vk-user.module'
import { forwardRef, Module } from '@nestjs/common'
import { Module } from '@nestjs/common'
import { MongooseModule } from '@nestjs/mongoose'
import { Jwt, JwtSchema } from './entities/jwt.entity'
import { JwtAuthGuard } from './guards/jwt-auth.guard'
import { JwtController } from './jwt.controller'
import { JwtService } from './jwt.service'

@Module({
imports: [
MongooseModule.forFeature([{ name: Jwt.name, schema: JwtSchema }]),
UserModule,
forwardRef(() => GoogleUserModule),
GoogleUserModule,
VkUserModule,
],
controllers: [JwtController],
providers: [JwtService],
exports: [JwtService, JwtAuthGuard],
exports: [JwtService],
})
export class JwtModule {}

0 comments on commit 043443c

Please sign in to comment.