(id)
| 25 | } |
| 26 | |
| 27 | findById(id) { |
| 28 | return db.DataRequest.findOne({ |
| 29 | where: { id }, |
| 30 | include: [ |
| 31 | { model: db.Connection, attributes: ["id", "name", "type", "subType", "host"] }, |
| 32 | { |
| 33 | model: db.VariableBinding, |
| 34 | on: Sequelize.and( |
| 35 | { "$VariableBindings.entity_type$": "DataRequest" }, |
| 36 | Sequelize.where( |
| 37 | Sequelize.cast(Sequelize.col("VariableBindings.entity_id"), "INTEGER"), |
| 38 | Sequelize.col("DataRequest.id") |
| 39 | ) |
| 40 | ), |
| 41 | required: false |
| 42 | } |
| 43 | ], |
| 44 | }) |
| 45 | .then((dataRequest) => { |
| 46 | if (!dataRequest) { |
| 47 | return new Promise((resolve, reject) => reject(new Error(404))); |
| 48 | } |
| 49 | return new Promise((resolve) => resolve(dataRequest)); |
| 50 | }) |
| 51 | .catch((error) => { |
| 52 | return new Promise((resolve, reject) => reject(error)); |
| 53 | }); |
| 54 | } |
| 55 | |
| 56 | findByChart(chartId) { |
| 57 | return db.DataRequest.findOne({ |
no outgoing calls
no test coverage detected