Browse Source

(*)定时任务处理提交

master
peng.peng 2 years ago
parent
commit
120fe7e0b2
  1. 23
      api/app/lib/controllers/metadataAcquisition/taskHandle.js

23
api/app/lib/controllers/metadataAcquisition/taskHandle.js

@ -1,5 +1,6 @@
const Automate = require('sequelize-automate-freesun')
const moment = require('moment');
async function handleTask(app, task) {
try {
@ -14,7 +15,27 @@ async function handleTask(app, task) {
const dbOptions = createDbOptions(dataSource.config);
const automate = new Automate(dbOptions, {});
const tables = await automate.getTables()
console.log(tables)
//创建或更新库元数据
const dataToSave = {
code: dataSource.config.database,
name: dataSource.config.database,
catalog: dataSource.mountPath,
parent: null,
description: null,
type: "库",
createBy: 1,
createAt: moment(),
updateAt: null,
user: { id: 1, name: "超级管理员", username: "SuperAdmin" },
attributesParam: null
}
// const databaseRslt = await models.MetadataDatabase.create(dataToSave)
//创建或更新表元数据
//创建或更新字段&索引&外键元数据
// MetadataDatabase
// console.log(databaseRslt)
}
} catch (error) {
app.fs.logger.error(`sechedule: handleTask, error: ${error}`);

Loading…
Cancel
Save