1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/common/entities/task/TaskScheduleDTO.ts

34 lines
665 B
TypeScript
Raw Normal View History

2019-07-28 04:56:12 +08:00
export enum TaskTriggerType {
never = 1, scheduled = 2, periodic = 3
}
export interface TaskTrigger {
type: TaskTriggerType;
}
export interface NeverTaskTrigger {
type: TaskTriggerType.never;
}
export interface ScheduledTaskTrigger extends TaskTrigger {
type: TaskTriggerType.scheduled;
time: number;
}
export interface PeriodicTaskTrigger extends TaskTrigger {
type: TaskTriggerType.periodic;
time: {
offset: number,
repeat: number
};
}
export interface TaskScheduleDTO {
priority: number;
name?: string;
id?: string;
taskName: string;
config: any;
trigger: NeverTaskTrigger | ScheduledTaskTrigger | PeriodicTaskTrigger;
}