cronjob ส่งข้อมูลผู้เกษียณไปให้ระบบพ้นราชการ #2330
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m17s

This commit is contained in:
harid 2026-05-05 16:43:47 +07:00
parent e6c3e80a3d
commit 93d4857ea1
4 changed files with 175 additions and 12 deletions

View file

@ -19,6 +19,7 @@ import { ScriptProfileOrgController } from "./controllers/ScriptProfileOrgContro
import { DateSerializer } from "./interfaces/date-serializer";
import { initWebSocket } from "./services/webSocket";
import { RetirementService } from "./services/RetirementService";
async function main() {
await AppDataSource.initialize();
@ -114,6 +115,17 @@ async function main() {
}
});
// Cron job for posting retirement data to Exprofile - every day at 04:30:00 on the 1st of October
const cronTime_PostRetire = "0 30 4 1 10 *";
cron.schedule(cronTime_PostRetire, async () => {
try {
const retirementService = new RetirementService();
await retirementService.cronjobPostRetireToExprofile();
} catch (error) {
console.error("[Cronjob] Error executing cronjobPostRetireToExprofile:", error);
}
});
// app.listen(APP_PORT, APP_HOST, () => console.log(`Listening on: http://localhost:${APP_PORT}`));
const server = app.listen(
APP_PORT,