- Add cron job to cleanup stale pending USB policies every 30 min - Add cleanupStalePendingPolicies mutation to usbPolicy.ts - Add USB policy fields to machines listByTenant query - Display USB status chip in device details and bulk control modal - Add details modal for emprestimos with all loan information - Add observacoesDevolucao field to preserve original observations - Fix status text size in details modal title 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
866 B
TypeScript
36 lines
866 B
TypeScript
import { cronJobs } from "convex/server"
|
|
import { api } from "./_generated/api"
|
|
|
|
const crons = cronJobs()
|
|
|
|
// Flags to keep heavy jobs disabled until the Convex backend stabilizes.
|
|
const reportsCronEnabled = process.env.REPORTS_CRON_ENABLED === "true"
|
|
const autoPauseCronEnabled = process.env.AUTO_PAUSE_ENABLED === "true"
|
|
|
|
if (reportsCronEnabled) {
|
|
crons.interval(
|
|
"report-export-runner",
|
|
{ minutes: 15 },
|
|
api.reports.triggerScheduledExports,
|
|
{}
|
|
)
|
|
}
|
|
|
|
if (autoPauseCronEnabled) {
|
|
crons.daily(
|
|
"auto-pause-internal-lunch",
|
|
{ hourUTC: 15, minuteUTC: 0 },
|
|
api.tickets.pauseInternalSessionsForLunch,
|
|
{}
|
|
)
|
|
}
|
|
|
|
// Cleanup de policies USB pendentes por mais de 1 hora (sem flag, sempre ativo)
|
|
crons.interval(
|
|
"cleanup-stale-usb-policies",
|
|
{ minutes: 30 },
|
|
api.usbPolicy.cleanupStalePendingPolicies,
|
|
{}
|
|
)
|
|
|
|
export default crons
|