25 lines
568 B
TypeScript
25 lines
568 B
TypeScript
import { cronJobs } from "convex/server"
|
|
import { api } from "./_generated/api"
|
|
|
|
const crons = cronJobs()
|
|
|
|
// Keep the handler available but only register it when explicitly enabled in Convex env.
|
|
const reportsCronEnabled = process.env.REPORTS_CRON_ENABLED === "true"
|
|
|
|
if (reportsCronEnabled) {
|
|
crons.interval(
|
|
"report-export-runner",
|
|
{ minutes: 15 },
|
|
api.reports.triggerScheduledExports,
|
|
{}
|
|
)
|
|
}
|
|
|
|
crons.daily(
|
|
"auto-pause-internal-lunch",
|
|
{ hourUTC: 15, minuteUTC: 0 },
|
|
api.tickets.pauseInternalSessionsForLunch,
|
|
{}
|
|
)
|
|
|
|
export default crons
|