mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
refactor: service dependencies (#13108)
refactor(server): simplify service dependency management
This commit is contained in:
parent
1b7e4b4e52
commit
4ea281f854
77 changed files with 802 additions and 1862 deletions
|
|
@ -1,17 +1,15 @@
|
|||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Duration } from 'luxon';
|
||||
import semver from 'semver';
|
||||
import { OnEvent } from 'src/decorators';
|
||||
import { IConfigRepository } from 'src/interfaces/config.interface';
|
||||
import {
|
||||
DatabaseExtension,
|
||||
DatabaseLock,
|
||||
EXTENSION_NAMES,
|
||||
IDatabaseRepository,
|
||||
VectorExtension,
|
||||
VectorIndex,
|
||||
} from 'src/interfaces/database.interface';
|
||||
import { ILoggerRepository } from 'src/interfaces/logger.interface';
|
||||
import { BaseService } from 'src/services/base.service';
|
||||
|
||||
type CreateFailedArgs = { name: string; extension: string; otherName: string };
|
||||
type UpdateFailedArgs = { name: string; extension: string; availableVersion: string };
|
||||
|
|
@ -63,17 +61,9 @@ const messages = {
|
|||
const RETRY_DURATION = Duration.fromObject({ seconds: 5 });
|
||||
|
||||
@Injectable()
|
||||
export class DatabaseService {
|
||||
export class DatabaseService extends BaseService {
|
||||
private reconnection?: NodeJS.Timeout;
|
||||
|
||||
constructor(
|
||||
@Inject(IConfigRepository) private configRepository: IConfigRepository,
|
||||
@Inject(IDatabaseRepository) private databaseRepository: IDatabaseRepository,
|
||||
@Inject(ILoggerRepository) private logger: ILoggerRepository,
|
||||
) {
|
||||
this.logger.setContext(DatabaseService.name);
|
||||
}
|
||||
|
||||
@OnEvent({ name: 'app.bootstrap', priority: -200 })
|
||||
async onBootstrap() {
|
||||
const version = await this.databaseRepository.getPostgresVersion();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue