fix: 修复内容审核模块依赖注入问题
- 在BaseContentAdapter中添加@InjectRepository装饰器 - 在ContentModerationModule中导入JwtModule和PlatformModule - 修复Repository依赖注入问题 - 确保应用正常启动
This commit is contained in:
parent
00bf807b31
commit
6b49fe9d1f
File diff suppressed because it is too large
Load Diff
|
|
@ -1,4 +1,5 @@
|
||||||
import { Injectable, BadRequestException } from '@nestjs/common';
|
import { Injectable, BadRequestException } from '@nestjs/common';
|
||||||
|
import { InjectRepository } from '@nestjs/typeorm';
|
||||||
import { HttpService } from '@nestjs/axios';
|
import { HttpService } from '@nestjs/axios';
|
||||||
import { ConfigService } from '@nestjs/config';
|
import { ConfigService } from '@nestjs/config';
|
||||||
import { Repository } from 'typeorm';
|
import { Repository } from 'typeorm';
|
||||||
|
|
@ -19,6 +20,7 @@ export abstract class BaseContentAdapter implements IContentModerationAdapter {
|
||||||
constructor(
|
constructor(
|
||||||
protected readonly httpService: HttpService,
|
protected readonly httpService: HttpService,
|
||||||
protected readonly configService: ConfigService,
|
protected readonly configService: ConfigService,
|
||||||
|
@InjectRepository(ContentAuditLogEntity)
|
||||||
protected readonly auditLogRepository: Repository<ContentAuditLogEntity>,
|
protected readonly auditLogRepository: Repository<ContentAuditLogEntity>,
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,8 @@
|
||||||
import { Module } from '@nestjs/common';
|
import { Module } from '@nestjs/common';
|
||||||
import { TypeOrmModule } from '@nestjs/typeorm';
|
import { TypeOrmModule } from '@nestjs/typeorm';
|
||||||
import { HttpModule } from '@nestjs/axios';
|
import { HttpModule } from '@nestjs/axios';
|
||||||
|
import { JwtModule } from '@nestjs/jwt';
|
||||||
|
import { PlatformModule } from '../platform/platform.module';
|
||||||
|
|
||||||
// 实体
|
// 实体
|
||||||
import { ContentAuditLogEntity } from './entities/content-audit-log.entity';
|
import { ContentAuditLogEntity } from './entities/content-audit-log.entity';
|
||||||
|
|
@ -26,6 +28,11 @@ import { ContentAuditGuard } from './guards/content-audit.guard';
|
||||||
timeout: 30000,
|
timeout: 30000,
|
||||||
maxRedirects: 3,
|
maxRedirects: 3,
|
||||||
}),
|
}),
|
||||||
|
JwtModule.register({
|
||||||
|
secret: process.env.JWT_SECRET || 'default-secret',
|
||||||
|
signOptions: { expiresIn: '1d' },
|
||||||
|
}),
|
||||||
|
PlatformModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
// 适配器实现
|
// 适配器实现
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue