MCPcopy Index your code
hub / github.com/chartbrew/chartbrew / addIntegration

Function addIntegration

server/controllers/AlertController.js:113–145  ·  view source on GitHub ↗
({
  alert_id, integration_id, enabled, type
})

Source from the content-addressed store, hash-verified

111}
112
113function addIntegration({
114 alert_id, integration_id, enabled, type
115}) {
116 // first check if the integration already exists
117 return db.AlertIntegration.findOne({
118 where: {
119 alert_id,
120 integration_id,
121 },
122 })
123 .then((alertIntegration) => {
124 if (alertIntegration) {
125 return db.AlertIntegration.update({
126 enabled,
127 type,
128 }, {
129 where: {
130 id: alertIntegration.id,
131 },
132 })
133 .then(() => {
134 return db.AlertIntegration.findByPk(alertIntegration.id);
135 });
136 }
137
138 return db.AlertIntegration.create({
139 alert_id,
140 integration_id,
141 enabled,
142 type,
143 });
144 });
145}
146
147module.exports = {
148 findById,

Callers

nothing calls this directly

Calls 2

updateMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected