Skip to content

Commit 0ff1506

Browse files
committed
chore: wip
1 parent 1c8af56 commit 0ff1506

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

.stacks/core/types/src/cron-jobs.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* Cron Job Options.
33
*/
4-
export interface CronJobOptions {
4+
export interface JobOptions {
55
/**
6-
* The name of the cron job.
6+
* The name of the job.
77
*/
88
name?: string
99
action?: string | Function
@@ -14,7 +14,12 @@ export interface CronJobOptions {
1414
timezone?: string
1515
active?: boolean
1616
}
17+
export type Job = JobOptions
18+
export type Jobs = Job[]
1719

20+
export interface CronJobOptions extends Omit<JobOptions, 'schedule'> {
21+
schedule: string
22+
}
1823
export type CronJob = CronJobOptions
1924
export type CronJobs = CronJob[]
2025

.stacks/core/utils/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ import type {
22
AppOptions,
33
CacheOptions,
44
CdnOptions,
5-
CronJobOptions,
65
DatabaseOptions,
76
DebugOptions,
87
DnsOptions,
98
EmailOptions,
109
Events,
1110
GitOptions,
1211
HashingOptions,
12+
JobOptions,
1313
LibraryOptions,
1414
Model,
1515
NotificationOptions,
@@ -40,7 +40,7 @@ export function defineCli(config: Partial<UserCliOptions>) {
4040
return config
4141
}
4242

43-
export function defineCronJobsConfig(config: Partial<CronJobOptions>[]) {
43+
export function defineCronJobsConfig(config: Partial<JobOptions>[]) {
4444
return config
4545
}
4646

app/jobs/demo-job.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { log } from '@stacksjs/cli'
22
import { Every } from '@stacksjs/types'
3-
import type { CronJob } from '@stacksjs/types'
3+
import type { Job } from '@stacksjs/types'
44

55
export default {
66
name: 'Demo Job', // defaults to the file name
@@ -10,4 +10,4 @@ export default {
1010
log.info('This cron job runs at every 5th minute')
1111
},
1212
// `run: 'demo-job'` is another option where `demo-job` refers to ./resources/functions/demo-job.ts
13-
} satisfies CronJob
13+
} satisfies Job

0 commit comments

Comments
 (0)