mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
improving config saving
This commit is contained in:
parent
5908bed64f
commit
f4e93c07c8
@ -1,10 +1,10 @@
|
||||
/* tslint:disable:no-inferrable-types */
|
||||
import 'reflect-metadata';
|
||||
import {DefaultsJobs} from '../../entities/job/JobDTO';
|
||||
import {JobScheduleDTO, JobTrigger, JobTriggerType} from '../../entities/job/JobScheduleDTO';
|
||||
import {ClientConfig} from '../public/ClientConfig';
|
||||
import {SubConfigClass} from 'typeconfig/src/decorators/class/SubConfigClass';
|
||||
import {ConfigProperty} from 'typeconfig/src/decorators/property/ConfigPropoerty';
|
||||
import {DefaultsJobs} from '../../entities/job/JobDTO';
|
||||
|
||||
export module ServerConfig {
|
||||
export enum DatabaseType {
|
||||
@ -159,7 +159,7 @@ export module ServerConfig {
|
||||
@ConfigProperty()
|
||||
afterScheduleName: string; // runs after schedule
|
||||
|
||||
constructor(afterScheduleName: string) {
|
||||
constructor(afterScheduleName?: string) {
|
||||
this.afterScheduleName = afterScheduleName;
|
||||
}
|
||||
}
|
||||
@ -177,8 +177,10 @@ export module ServerConfig {
|
||||
@ConfigProperty()
|
||||
allowParallelRun: boolean;
|
||||
@ConfigProperty({
|
||||
type: NeverJobTrigger,
|
||||
typeBuilder: (v: JobTrigger) => {
|
||||
switch (v.type) {
|
||||
const type = typeof v.type === 'number' ? v.type : JobTriggerType[v.type];
|
||||
switch (type) {
|
||||
case JobTriggerType.after:
|
||||
return AfterJobTrigger;
|
||||
case JobTriggerType.never:
|
||||
@ -232,7 +234,7 @@ export module ServerConfig {
|
||||
new JobScheduleConfig(DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']],
|
||||
DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']],
|
||||
false,
|
||||
new AfterJobTrigger(DefaultsJobs[DefaultsJobs['Photo Converting']]), {}
|
||||
new AfterJobTrigger(DefaultsJobs[DefaultsJobs['Video Converting']]), {}
|
||||
),
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user