(data, user)
| 97 | } |
| 98 | |
| 99 | create(data, user) { |
| 100 | return db.Chart.create({ ...data, chartDataUpdated: moment() }) |
| 101 | .then((chart) => { |
| 102 | // delete chart cache |
| 103 | if (user) { |
| 104 | this.chartCache.remove(user.id, chart.id); |
| 105 | } |
| 106 | |
| 107 | return this.findById(chart.id); |
| 108 | }) |
| 109 | .catch((error) => { |
| 110 | return new Promise((resolve, reject) => reject(error)); |
| 111 | }); |
| 112 | } |
| 113 | |
| 114 | findAll(conditions = {}) { |
| 115 | return db.Chart.findAll(conditions) |