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 { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { User } from 'src/users/entities/user.entity';
|
import { User } from 'src/users/entities/user.entity';
|
||||||
import { Password } from 'src/users/entities/password.entity';
|
import { Password } from 'src/users/entities/password.entity';
|
||||||
import { JwtModule } from '@nestjs/jwt';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { ConfigModule, ConfigService } from '@nestjs/config';
|
|
||||||
import { DbTransactionFactory } from 'src/database/transaction-factory';
|
import { DbTransactionFactory } from 'src/database/transaction-factory';
|
||||||
import { Session } from './entities/session.entity';
|
import { Session } from './entities/session.entity';
|
||||||
import { PasswordResetToken } from './entities/password-reset-token.entity';
|
import { PasswordResetToken } from './entities/password-reset-token.entity';
|
||||||
import { VerificationCode } from './entities/verification-code.entity';
|
import { VerificationCode } from './entities/verification-code.entity';
|
||||||
import { MailModule } from 'src/mail/mail.module';
|
import { MailModule } from 'src/mail/mail.module';
|
||||||
import { CustomJwtService } from './services/jwt.service';
|
|
||||||
import { VerificationCodeService } from './services/verification-code.service';
|
import { VerificationCodeService } from './services/verification-code.service';
|
||||||
import { UsersModule } from 'src/users/users.module';
|
import { UsersModule } from 'src/users/users.module';
|
||||||
|
import { JwtSharedModule } from './jwt-shared.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
@ -24,13 +23,7 @@ import { UsersModule } from 'src/users/users.module';
|
|||||||
PasswordResetToken,
|
PasswordResetToken,
|
||||||
VerificationCode,
|
VerificationCode,
|
||||||
]),
|
]),
|
||||||
JwtModule.registerAsync({
|
JwtSharedModule,
|
||||||
imports: [ConfigModule],
|
|
||||||
useFactory: async (configService: ConfigService) => ({
|
|
||||||
secret: configService.get<string>('JWT_SECRET'),
|
|
||||||
}),
|
|
||||||
inject: [ConfigService],
|
|
||||||
}),
|
|
||||||
MailModule,
|
MailModule,
|
||||||
UsersModule,
|
UsersModule,
|
||||||
],
|
],
|
||||||
@ -39,7 +32,6 @@ import { UsersModule } from 'src/users/users.module';
|
|||||||
AuthService,
|
AuthService,
|
||||||
ConfigService,
|
ConfigService,
|
||||||
DbTransactionFactory,
|
DbTransactionFactory,
|
||||||
CustomJwtService,
|
|
||||||
VerificationCodeService,
|
VerificationCodeService,
|
||||||
],
|
],
|
||||||
exports: [AuthService],
|
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 { User } from './entities/user.entity';
|
||||||
import { Password } from './entities/password.entity';
|
import { Password } from './entities/password.entity';
|
||||||
import { DbTransactionFactory } from 'src/database/transaction-factory';
|
import { DbTransactionFactory } from 'src/database/transaction-factory';
|
||||||
|
import { JwtSharedModule } from 'src/auth/jwt-shared.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
TypeOrmModule.forFeature([User, Password]),
|
TypeOrmModule.forFeature([User, Password]),
|
||||||
|
JwtSharedModule,
|
||||||
],
|
],
|
||||||
controllers: [UsersController],
|
controllers: [UsersController],
|
||||||
providers: [UsersService, DbTransactionFactory],
|
providers: [UsersService, DbTransactionFactory],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user