mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
f8a361cb9e
note: braking changes in database and config file
31 lines
895 B
TypeScript
31 lines
895 B
TypeScript
import {ITask} from './tasks/ITask';
|
|
import {IndexingTask} from './tasks/IndexingTask';
|
|
import {DBRestTask} from './tasks/DBResetTask';
|
|
import {VideoConvertingTask} from './tasks/VideoConvertingTask';
|
|
|
|
export class TaskRepository {
|
|
|
|
private static instance: TaskRepository = null;
|
|
availableTasks: { [key: string]: ITask<any> } = {};
|
|
|
|
public static get Instance(): TaskRepository {
|
|
if (TaskRepository.instance == null) {
|
|
TaskRepository.instance = new TaskRepository();
|
|
}
|
|
return TaskRepository.instance;
|
|
}
|
|
|
|
getAvailableTasks(): ITask<any>[] {
|
|
return Object.values(this.availableTasks).filter(t => t.Supported);
|
|
}
|
|
|
|
register(task: ITask<any>) {
|
|
this.availableTasks[task.Name] = task;
|
|
}
|
|
}
|
|
|
|
|
|
TaskRepository.Instance.register(new IndexingTask());
|
|
TaskRepository.Instance.register(new DBRestTask());
|
|
TaskRepository.Instance.register(new VideoConvertingTask());
|