fix circular dependency in DriveFileEntityService.ts
This commit is contained in:
parent
5b01ed54b9
commit
697c897d94
1 changed files with 13 additions and 7 deletions
|
|
@ -3,8 +3,9 @@
|
|||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
import { forwardRef, Inject, Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable, OnModuleInit } from '@nestjs/common';
|
||||
import { In } from 'typeorm';
|
||||
import { ModuleRef } from '@nestjs/core';
|
||||
import { DI } from '@/di-symbols.js';
|
||||
import type { DriveFilesRepository } from '@/models/_.js';
|
||||
import type { Config } from '@/config.js';
|
||||
|
|
@ -19,8 +20,8 @@ import { isMimeImage } from '@/misc/is-mime-image.js';
|
|||
import { IdService } from '@/core/IdService.js';
|
||||
import { UtilityService } from '../UtilityService.js';
|
||||
import { VideoProcessingService } from '../VideoProcessingService.js';
|
||||
import { UserEntityService } from './UserEntityService.js';
|
||||
import { DriveFolderEntityService } from './DriveFolderEntityService.js';
|
||||
import type { UserEntityService } from './UserEntityService.js';
|
||||
|
||||
type PackOptions = {
|
||||
detail?: boolean,
|
||||
|
|
@ -29,18 +30,18 @@ type PackOptions = {
|
|||
};
|
||||
|
||||
@Injectable()
|
||||
export class DriveFileEntityService {
|
||||
export class DriveFileEntityService implements OnModuleInit {
|
||||
private userEntityService: UserEntityService;
|
||||
|
||||
constructor(
|
||||
private readonly moduleRef: ModuleRef,
|
||||
|
||||
@Inject(DI.config)
|
||||
private config: Config,
|
||||
|
||||
@Inject(DI.driveFilesRepository)
|
||||
private driveFilesRepository: DriveFilesRepository,
|
||||
|
||||
// 循環参照のため / for circular dependency
|
||||
@Inject(forwardRef(() => UserEntityService))
|
||||
private userEntityService: UserEntityService,
|
||||
|
||||
private utilityService: UtilityService,
|
||||
private driveFolderEntityService: DriveFolderEntityService,
|
||||
private videoProcessingService: VideoProcessingService,
|
||||
|
|
@ -48,6 +49,11 @@ export class DriveFileEntityService {
|
|||
) {
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public onModuleInit() {
|
||||
this.userEntityService = this.moduleRef.get('UserEntityService');
|
||||
}
|
||||
|
||||
@bindThis
|
||||
public validateFileName(name: string): boolean {
|
||||
return (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue