mirror of
https://github.com/immich-app/immich.git
synced 2026-06-06 14:55:17 -04:00
feat: workflows & plugins (#26727)
feat: plugins chore: better types feat: plugins
This commit is contained in:
@@ -58,6 +58,7 @@ import { ViewRepository } from 'src/repositories/view-repository';
|
||||
import { WebsocketRepository } from 'src/repositories/websocket.repository';
|
||||
import { WorkflowRepository } from 'src/repositories/workflow.repository';
|
||||
import { UserTable } from 'src/schema/tables/user.table';
|
||||
import { ClassConstructor } from 'src/types';
|
||||
import { AccessRequest, checkAccess, requireAccess } from 'src/utils/access';
|
||||
import { getConfig, updateConfig } from 'src/utils/config';
|
||||
|
||||
@@ -187,6 +188,66 @@ export class BaseService {
|
||||
);
|
||||
}
|
||||
|
||||
static create<T extends BaseService>(Service: ClassConstructor<T>, ctx: BaseService) {
|
||||
const service = new Service(
|
||||
LoggingRepository.create(),
|
||||
ctx.accessRepository,
|
||||
ctx.activityRepository,
|
||||
ctx.albumRepository,
|
||||
ctx.albumUserRepository,
|
||||
ctx.apiKeyRepository,
|
||||
ctx.appRepository,
|
||||
ctx.assetRepository,
|
||||
ctx.assetEditRepository,
|
||||
ctx.assetJobRepository,
|
||||
ctx.configRepository,
|
||||
ctx.cronRepository,
|
||||
ctx.cryptoRepository,
|
||||
ctx.databaseRepository,
|
||||
ctx.downloadRepository,
|
||||
ctx.duplicateRepository,
|
||||
ctx.emailRepository,
|
||||
ctx.eventRepository,
|
||||
ctx.jobRepository,
|
||||
ctx.libraryRepository,
|
||||
ctx.machineLearningRepository,
|
||||
ctx.mapRepository,
|
||||
ctx.mediaRepository,
|
||||
ctx.memoryRepository,
|
||||
ctx.metadataRepository,
|
||||
ctx.moveRepository,
|
||||
ctx.notificationRepository,
|
||||
ctx.oauthRepository,
|
||||
ctx.ocrRepository,
|
||||
ctx.partnerRepository,
|
||||
ctx.personRepository,
|
||||
ctx.pluginRepository,
|
||||
ctx.processRepository,
|
||||
ctx.searchRepository,
|
||||
ctx.serverInfoRepository,
|
||||
ctx.sessionRepository,
|
||||
ctx.sharedLinkRepository,
|
||||
ctx.sharedLinkAssetRepository,
|
||||
ctx.stackRepository,
|
||||
ctx.storageRepository,
|
||||
ctx.syncRepository,
|
||||
ctx.syncCheckpointRepository,
|
||||
ctx.systemMetadataRepository,
|
||||
ctx.tagRepository,
|
||||
ctx.telemetryRepository,
|
||||
ctx.trashRepository,
|
||||
ctx.userRepository,
|
||||
ctx.versionRepository,
|
||||
ctx.viewRepository,
|
||||
ctx.websocketRepository,
|
||||
ctx.workflowRepository,
|
||||
);
|
||||
|
||||
service.logger.setContext(this.name);
|
||||
|
||||
return service as T;
|
||||
}
|
||||
|
||||
get worker() {
|
||||
return this.configRepository.getWorker();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user