Updated A LOT

This commit is contained in:
2026-06-05 04:15:24 -05:00
parent 8335f1af1b
commit 4072695432
92 changed files with 16139 additions and 570 deletions

View File

@@ -1,4 +1,6 @@
const { createApp } = require('./app');
const { runAlertCycle } = require('./services/alerts');
const { runScheduledSync } = require('./services/workday');
const PORT = Number(process.env.PORT || process.env.MIXEDASSETS_PORT || 3000);
const app = createApp();
@@ -6,3 +8,21 @@ const app = createApp();
app.listen(PORT, () => {
console.log(`MixedAssets API listening on http://localhost:${PORT}`);
});
// Periodically scan for due/expiring items and email digests. These are no-ops
// unless alerts are enabled and SMTP is configured. Runs after boot, then twice daily.
function scheduleAlertCycle() {
const tick = () => runAlertCycle(null).catch((error) => console.error('Alert cycle failed:', error.message));
setTimeout(tick, 30_000).unref();
setInterval(tick, 12 * 60 * 60 * 1000).unref();
}
// Hourly check for a due automatic Workday sync (respects the configured interval).
function scheduleWorkdaySync() {
const tick = () => runScheduledSync().catch((error) => console.error('Workday sync failed:', error.message));
setTimeout(tick, 60_000).unref();
setInterval(tick, 60 * 60 * 1000).unref();
}
scheduleAlertCycle();
scheduleWorkdaySync();