mirror of
https://github.com/Art051/immich.git
synced 2025-08-11 19:29:00 +00:00
* refactor(server): bootstrap code * Add service name --------- Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
28 lines
850 B
TypeScript
28 lines
850 B
TypeScript
import { JobService, MACHINE_LEARNING_ENABLED, SearchService, StorageService } from '@app/domain';
|
|
import { Injectable, Logger } from '@nestjs/common';
|
|
import { Cron, CronExpression } from '@nestjs/schedule';
|
|
|
|
@Injectable()
|
|
export class AppService {
|
|
private logger = new Logger(AppService.name);
|
|
|
|
constructor(
|
|
private jobService: JobService,
|
|
private searchService: SearchService,
|
|
private storageService: StorageService,
|
|
) {}
|
|
|
|
@Cron(CronExpression.EVERY_DAY_AT_MIDNIGHT)
|
|
async onNightlyJob() {
|
|
await this.jobService.handleNightlyJobs();
|
|
}
|
|
|
|
async init() {
|
|
this.storageService.init();
|
|
await this.searchService.init();
|
|
|
|
this.logger.log(`Machine learning is ${MACHINE_LEARNING_ENABLED ? 'enabled' : 'disabled'}`);
|
|
this.logger.log(`Search is ${this.searchService.isEnabled() ? 'enabled' : 'disabled'}`);
|
|
}
|
|
}
|