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 */
|
/* tslint:disable:no-inferrable-types */
|
||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
import {DefaultsJobs} from '../../entities/job/JobDTO';
|
|
||||||
import {JobScheduleDTO, JobTrigger, JobTriggerType} from '../../entities/job/JobScheduleDTO';
|
import {JobScheduleDTO, JobTrigger, JobTriggerType} from '../../entities/job/JobScheduleDTO';
|
||||||
import {ClientConfig} from '../public/ClientConfig';
|
import {ClientConfig} from '../public/ClientConfig';
|
||||||
import {SubConfigClass} from 'typeconfig/src/decorators/class/SubConfigClass';
|
import {SubConfigClass} from 'typeconfig/src/decorators/class/SubConfigClass';
|
||||||
import {ConfigProperty} from 'typeconfig/src/decorators/property/ConfigPropoerty';
|
import {ConfigProperty} from 'typeconfig/src/decorators/property/ConfigPropoerty';
|
||||||
|
import {DefaultsJobs} from '../../entities/job/JobDTO';
|
||||||
|
|
||||||
export module ServerConfig {
|
export module ServerConfig {
|
||||||
export enum DatabaseType {
|
export enum DatabaseType {
|
||||||
@ -159,7 +159,7 @@ export module ServerConfig {
|
|||||||
@ConfigProperty()
|
@ConfigProperty()
|
||||||
afterScheduleName: string; // runs after schedule
|
afterScheduleName: string; // runs after schedule
|
||||||
|
|
||||||
constructor(afterScheduleName: string) {
|
constructor(afterScheduleName?: string) {
|
||||||
this.afterScheduleName = afterScheduleName;
|
this.afterScheduleName = afterScheduleName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -177,8 +177,10 @@ export module ServerConfig {
|
|||||||
@ConfigProperty()
|
@ConfigProperty()
|
||||||
allowParallelRun: boolean;
|
allowParallelRun: boolean;
|
||||||
@ConfigProperty({
|
@ConfigProperty({
|
||||||
|
type: NeverJobTrigger,
|
||||||
typeBuilder: (v: JobTrigger) => {
|
typeBuilder: (v: JobTrigger) => {
|
||||||
switch (v.type) {
|
const type = typeof v.type === 'number' ? v.type : JobTriggerType[v.type];
|
||||||
|
switch (type) {
|
||||||
case JobTriggerType.after:
|
case JobTriggerType.after:
|
||||||
return AfterJobTrigger;
|
return AfterJobTrigger;
|
||||||
case JobTriggerType.never:
|
case JobTriggerType.never:
|
||||||
@ -232,7 +234,7 @@ export module ServerConfig {
|
|||||||
new JobScheduleConfig(DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']],
|
new JobScheduleConfig(DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']],
|
||||||
DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']],
|
DefaultsJobs[DefaultsJobs['Temp Folder Cleaning']],
|
||||||
false,
|
false,
|
||||||
new AfterJobTrigger(DefaultsJobs[DefaultsJobs['Photo Converting']]), {}
|
new AfterJobTrigger(DefaultsJobs[DefaultsJobs['Video Converting']]), {}
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user