2016-02-07 15:32:02 -06:00
|
|
|
import DB from './../config/database.js';
|
|
|
|
|
|
2016-02-09 11:16:49 -06:00
|
|
|
const NAME = 'PowerController';
|
|
|
|
|
|
2016-02-07 15:32:02 -06:00
|
|
|
class PowerController{
|
|
|
|
|
|
|
|
|
|
static index(req, res){
|
|
|
|
|
DB.House.findOne({where: {name: req.housename}}).then((house)=>{
|
2016-02-09 11:16:49 -06:00
|
|
|
house.getPowerDataByTime(req.params.start_time, req.params.end_time).then((power_data)=>{
|
2016-02-07 15:32:02 -06:00
|
|
|
res.json(power_data);
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2016-02-09 11:16:49 -06:00
|
|
|
|
|
|
|
|
PowerController.NAME = NAME;
|
|
|
|
|
module.exports = PowerController;
|