From 8060cfff8abee005877a7f4e162da3631ad9f99a Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Thu, 27 Oct 2022 14:47:01 +0800 Subject: [PATCH] AlarmPushConfig --- api/app/lib/controllers/push/config.js | 2 +- api/app/lib/index.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/api/app/lib/controllers/push/config.js b/api/app/lib/controllers/push/config.js index 7e8325e..01eedd2 100644 --- a/api/app/lib/controllers/push/config.js +++ b/api/app/lib/controllers/push/config.js @@ -22,7 +22,7 @@ async function list (ctx) { if (keywordTarget == 'tactics') { findOption.where.name = { $like: `%${keyword}%` } } else if (keywordTarget == 'struc') { - let bindAnixinStrucRes = await clickHouse.anxinyun.query(` + let bindAnixinStrucRes = await clickHouse.projectManage.query(` SELECT id, name FROM t_structure WHERE name LIKE '%${keyword}%' `).toPromise() diff --git a/api/app/lib/index.js b/api/app/lib/index.js index 10a1b33..6788fa6 100644 --- a/api/app/lib/index.js +++ b/api/app/lib/index.js @@ -58,7 +58,8 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq }); const { - AppInspection, ProjectApp, ProjectCorrelation, AppAlarm, App, AlarmAppearRecord, AlarmConfirmLog, EmailSendLog, LatestDynamicList + AppInspection, ProjectApp, ProjectCorrelation, AppAlarm, App, AlarmAppearRecord, AlarmConfirmLog, EmailSendLog, LatestDynamicList, + AlarmPushConfig } = dc.models; AppInspection.belongsTo(App, { foreignKey: 'projectAppId', targetKey: 'id' }); @@ -77,7 +78,8 @@ module.exports.models = function (dc) { // dc = { orm: Sequelize对象, ORM: Seq AppAlarm.belongsTo(App, { foreignKey: 'projectAppId', targetKey: 'id' }); App.hasMany(AppAlarm, { foreignKey: 'projectAppId', sourceKey: 'id' }); - + AlarmPushConfig.belongsTo(ProjectCorrelation, { foreignKey: 'pomsProjectId', targetKey: 'id' }); + ProjectCorrelation.hasMany(AlarmPushConfig, { foreignKey: 'pomsProjectId', sourceKey: 'id' }); AlarmAppearRecord.belongsTo(ProjectCorrelation, { foreignKey: 'projectCorrelationId', targetKey: 'id' }); ProjectCorrelation.hasMany(AlarmAppearRecord, { foreignKey: 'projectCorrelationId', sourceKey: 'id' });