Fix modules error
This commit is contained in:
parent
9e4d10c1ec
commit
6cb2f67a8c
@ -4,16 +4,15 @@ import { AuthService } from './services/auth.service';
|
||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { User } from 'src/users/entities/user.entity';
|
||||
import { Password } from 'src/users/entities/password.entity';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { ConfigService } from '@nestjs/config';
|
||||
import { DbTransactionFactory } from 'src/database/transaction-factory';
|
||||
import { Session } from './entities/session.entity';
|
||||
import { PasswordResetToken } from './entities/password-reset-token.entity';
|
||||
import { VerificationCode } from './entities/verification-code.entity';
|
||||
import { MailModule } from 'src/mail/mail.module';
|
||||
import { CustomJwtService } from './services/jwt.service';
|
||||
import { VerificationCodeService } from './services/verification-code.service';
|
||||
import { UsersModule } from 'src/users/users.module';
|
||||
import { JwtSharedModule } from './jwt-shared.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
@ -24,13 +23,7 @@ import { UsersModule } from 'src/users/users.module';
|
||||
PasswordResetToken,
|
||||
VerificationCode,
|
||||
]),
|
||||
JwtModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: async (configService: ConfigService) => ({
|
||||
secret: configService.get<string>('JWT_SECRET'),
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
JwtSharedModule,
|
||||
MailModule,
|
||||
UsersModule,
|
||||
],
|
||||
@ -39,7 +32,6 @@ import { UsersModule } from 'src/users/users.module';
|
||||
AuthService,
|
||||
ConfigService,
|
||||
DbTransactionFactory,
|
||||
CustomJwtService,
|
||||
VerificationCodeService,
|
||||
],
|
||||
exports: [AuthService],
|
||||
|
||||
19
src/auth/jwt-shared.module.ts
Normal file
19
src/auth/jwt-shared.module.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { JwtModule } from '@nestjs/jwt';
|
||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
||||
import { CustomJwtService } from './services/jwt.service';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
JwtModule.registerAsync({
|
||||
imports: [ConfigModule],
|
||||
useFactory: async (configService: ConfigService) => ({
|
||||
secret: configService.get<string>('JWT_SECRET'),
|
||||
}),
|
||||
inject: [ConfigService],
|
||||
}),
|
||||
],
|
||||
providers: [CustomJwtService],
|
||||
exports: [CustomJwtService],
|
||||
})
|
||||
export class JwtSharedModule {}
|
||||
@ -5,10 +5,12 @@ import { TypeOrmModule } from '@nestjs/typeorm';
|
||||
import { User } from './entities/user.entity';
|
||||
import { Password } from './entities/password.entity';
|
||||
import { DbTransactionFactory } from 'src/database/transaction-factory';
|
||||
import { JwtSharedModule } from 'src/auth/jwt-shared.module';
|
||||
|
||||
@Module({
|
||||
imports: [
|
||||
TypeOrmModule.forFeature([User, Password]),
|
||||
JwtSharedModule,
|
||||
],
|
||||
controllers: [UsersController],
|
||||
providers: [UsersService, DbTransactionFactory],
|
||||
|
||||
Loading…
Reference in New Issue
Block a user