Skip to content

Commit c3e79fb

Browse files
committed
chore: wip
1 parent c04496a commit c3e79fb

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,15 @@ export interface CronJobOptions {
1616

1717
export type CronJob = CronJobOptions
1818
export type CronJobs = CronJob[]
19+
20+
export enum Every {
21+
Minute = '* * * * *',
22+
Hour = '0 * * * *',
23+
HalfHour = '0,30 * * * *',
24+
Day = '0 0 * * *',
25+
Month = '0 0 1 * *',
26+
Week = '0 0 * * 0',
27+
Year = '0 0 1 1 *',
28+
FifthMinute = '*/5 * * * *',
29+
TenthMinute = '*/10 * * * *',
30+
}

app/jobs/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
import { Every } from '@stacksjs/types'
12
import type { CronJob } from '@stacksjs/types'
23

34
export default {
45
// required
5-
schedule: '*/5 * * * *', // at every 5th minute
6+
schedule: Every.FifthMinute, // or '*/5 * * * *'
67
action: () => {
78
// eslint-disable-next-line no-console
89
console.log('This cron job runs every 5th minute')

0 commit comments

Comments
 (0)