gitlab_monitor/schedule/syncPipeLine.ts
zhaoyingbo f5ee6f8555
All checks were successful
CI Monitor MIflow / build-image (push) Successful in 45s
feat: 修改监控Stage的方式
2024-08-08 11:04:09 +00:00

30 lines
1012 B
TypeScript

import managePipeline from "../controllers/managePipeLine"
import manageProject from "../controllers/manageProject"
import manageUser from "../controllers/manageUser"
/**
* 同步管道函数
*
* 该函数首先获取完整的项目列表,然后获取每个项目的完整管道列表。
* 接着,它获取完整的用户映射和项目映射,最后将这些数据插入到管道列表中。
*
* @async
* @function syncPipLine
* @returns {Promise<void>} 不返回任何内容
*/
const syncPipeLine = async (): Promise<void> => {
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
)
}
export default syncPipeLine