Initial commit: teaching institution management API.

Express/MongoDB backend with JWT auth, RBAC, S3 uploads, notifications, and scheduled jobs.
This commit is contained in:
2026-08-09 04:18:08 +02:00
commit f04c797be6
107 changed files with 9190 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
// /jobs/tempBucketCleanupJob.js
const cron = require('node-cron');
const { cleanupTempBucket } = require('../utils/s3Client');
const logger = require('../utils/logger');
const runTempBucketCleanupJob = async () => {
try {
logger.info('[TempBucketCleanupJob] Starting daily temp bucket cleanup...');
const deletedCount = await cleanupTempBucket(10); // Files older than 10 minutes
logger.info(`[TempBucketCleanupJob] Daily cleanup finished. Removed ${deletedCount} files.`);
} catch (error) {
logger.error(`[TempBucketCleanupJob ERROR]: ${error.message}`);
}
};
const startTempBucketCleanupJob = () => {
// Schedule daily at 3:00 AM
cron.schedule('0 3 * * *', async () => {
await runTempBucketCleanupJob();
});
logger.info('[TempBucketCleanupJob] Scheduled to run daily at 3:00 AM.');
};
module.exports = {
startTempBucketCleanupJob,
runTempBucketCleanupJob
};