File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change 1
1
/**
2
2
* Cron Job Options.
3
3
*/
4
- export interface CronJobOptions {
4
+ export interface JobOptions {
5
5
/**
6
- * The name of the cron job.
6
+ * The name of the job.
7
7
*/
8
8
name ?: string
9
9
action ?: string | Function
@@ -14,7 +14,12 @@ export interface CronJobOptions {
14
14
timezone ?: string
15
15
active ?: boolean
16
16
}
17
+ export type Job = JobOptions
18
+ export type Jobs = Job [ ]
17
19
20
+ export interface CronJobOptions extends Omit < JobOptions , 'schedule' > {
21
+ schedule : string
22
+ }
18
23
export type CronJob = CronJobOptions
19
24
export type CronJobs = CronJob [ ]
20
25
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ import type {
2
2
AppOptions ,
3
3
CacheOptions ,
4
4
CdnOptions ,
5
- CronJobOptions ,
6
5
DatabaseOptions ,
7
6
DebugOptions ,
8
7
DnsOptions ,
9
8
EmailOptions ,
10
9
Events ,
11
10
GitOptions ,
12
11
HashingOptions ,
12
+ JobOptions ,
13
13
LibraryOptions ,
14
14
Model ,
15
15
NotificationOptions ,
@@ -40,7 +40,7 @@ export function defineCli(config: Partial<UserCliOptions>) {
40
40
return config
41
41
}
42
42
43
- export function defineCronJobsConfig ( config : Partial < CronJobOptions > [ ] ) {
43
+ export function defineCronJobsConfig ( config : Partial < JobOptions > [ ] ) {
44
44
return config
45
45
}
46
46
Original file line number Diff line number Diff line change 1
1
import { log } from '@stacksjs/cli'
2
2
import { Every } from '@stacksjs/types'
3
- import type { CronJob } from '@stacksjs/types'
3
+ import type { Job } from '@stacksjs/types'
4
4
5
5
export default {
6
6
name : 'Demo Job' , // defaults to the file name
@@ -10,4 +10,4 @@ export default {
10
10
log . info ( 'This cron job runs at every 5th minute' )
11
11
} ,
12
12
// `run: 'demo-job'` is another option where `demo-job` refers to ./resources/functions/demo-job.ts
13
- } satisfies CronJob
13
+ } satisfies Job
You can’t perform that action at this time.
0 commit comments