completed sync script update keycloak
This commit is contained in:
parent
a487b73c3b
commit
625885973e
13 changed files with 1867 additions and 466 deletions
44
src/app.ts
44
src/app.ts
|
|
@ -15,6 +15,7 @@ import { logMemoryStore } from "./utils/LogMemoryStore";
|
|||
import { orgStructureCache } from "./utils/OrgStructureCache";
|
||||
import { CommandController } from "./controllers/CommandController";
|
||||
import { ProfileSalaryController } from "./controllers/ProfileSalaryController";
|
||||
import { ScriptProfileOrgController } from "./controllers/ScriptProfileOrgController";
|
||||
import { DateSerializer } from "./interfaces/date-serializer";
|
||||
|
||||
import { initWebSocket } from "./services/webSocket";
|
||||
|
|
@ -52,19 +53,8 @@ async function main() {
|
|||
const APP_HOST = process.env.APP_HOST || "0.0.0.0";
|
||||
const APP_PORT = +(process.env.APP_PORT || 3000);
|
||||
|
||||
const cronTime = "0 0 3 * * *"; // ตั้งเวลาทุกวันเวลา 03:00:00
|
||||
// const cronTime = "*/10 * * * * *";
|
||||
cron.schedule(cronTime, async () => {
|
||||
try {
|
||||
const orgController = new OrganizationController();
|
||||
await orgController.cronjobRevision();
|
||||
} catch (error) {
|
||||
console.error("Error executing function from controller:", error);
|
||||
}
|
||||
});
|
||||
|
||||
const cronTime_command = "0 0 2 * * *";
|
||||
// const cronTime_command = "*/10 * * * * *";
|
||||
// Cron job for executing command - every day at 00:30:00
|
||||
const cronTime_command = "0 30 0 * * *";
|
||||
cron.schedule(cronTime_command, async () => {
|
||||
try {
|
||||
const commandController = new CommandController();
|
||||
|
|
@ -74,7 +64,19 @@ async function main() {
|
|||
}
|
||||
});
|
||||
|
||||
const cronTime_Oct = "0 0 1 10 *";
|
||||
// Cron job for updating org revision - every day at 01:00:00
|
||||
const cronTime = "0 0 1 * * *";
|
||||
cron.schedule(cronTime, async () => {
|
||||
try {
|
||||
const orgController = new OrganizationController();
|
||||
await orgController.cronjobRevision();
|
||||
} catch (error) {
|
||||
console.error("Error executing function from controller:", error);
|
||||
}
|
||||
});
|
||||
|
||||
// Cron job for updating retirement status - every day at 02:00:00 on the 1st of October
|
||||
const cronTime_Oct = "0 0 2 10 *";
|
||||
cron.schedule(cronTime_Oct, async () => {
|
||||
try {
|
||||
const commandController = new CommandController();
|
||||
|
|
@ -84,7 +86,19 @@ async function main() {
|
|||
}
|
||||
});
|
||||
|
||||
const cronTime_Tenure = "0 0 0 * * *";
|
||||
// Cron job for updating org DNA - every day at 03:00:00
|
||||
const cronTime_UpdateOrg = "0 0 3 * * *";
|
||||
cron.schedule(cronTime_UpdateOrg, async () => {
|
||||
try {
|
||||
const scriptProfileOrgController = new ScriptProfileOrgController();
|
||||
await scriptProfileOrgController.cronjobUpdateOrg({} as any);
|
||||
} catch (error) {
|
||||
console.error("Error executing cronjobUpdateOrg:", error);
|
||||
}
|
||||
});
|
||||
|
||||
// Cron job for updating tenure - every day at 04:00:00
|
||||
const cronTime_Tenure = "0 0 4 * * *";
|
||||
cron.schedule(cronTime_Tenure, async () => {
|
||||
try {
|
||||
const profileSalaryController = new ProfileSalaryController();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue