34 lines
959 B
TypeScript
34 lines
959 B
TypeScript
import { scheduleJob } from "node-schedule";
|
|
import managePipeline from "./controllers/managePipeLine";
|
|
import manageProject from "./controllers/manageProject";
|
|
import manageUser from "./controllers/manageUser";
|
|
import manageRobot from "./controllers/manageRobot";
|
|
|
|
const main = async () => {
|
|
const fullProjList = await manageProject.getFullProjList();
|
|
const fullPipelineList = await Promise.all(
|
|
fullProjList.map((v) => managePipeline.getFullPipelineList(v))
|
|
);
|
|
const fullUserMap = await manageUser.getFullUserMap(fullPipelineList);
|
|
const fullProjectMap = await manageProject.getFullProjectMap(fullProjList);
|
|
await managePipeline.insertFullPipelineList(
|
|
fullPipelineList,
|
|
fullUserMap,
|
|
fullProjectMap
|
|
);
|
|
};
|
|
|
|
main();
|
|
|
|
scheduleJob("*/15 * * * *", main);
|
|
|
|
scheduleJob("0 10 * * 5", manageRobot.sendRobotMsg);
|
|
|
|
Bun.serve({
|
|
async fetch() {
|
|
await manageRobot.sendRobotMsg();
|
|
return new Response("OK");
|
|
},
|
|
port: 3000,
|
|
});
|