28 lines
658 B
JavaScript
28 lines
658 B
JavaScript
/**
|
|
* CardController
|
|
*
|
|
* @description :: Server-side logic for managing cards
|
|
* @help :: See http://sailsjs.org/#!/documentation/concepts/Controllers
|
|
*/
|
|
|
|
var getValuesClosestTo = function(dtime){
|
|
|
|
};
|
|
|
|
module.exports = {
|
|
latest: function(req, res){
|
|
Card.find({sort: 'id DESC', limit: 1}).exec(function(err, latestCard){
|
|
if (err) return res.serverError(err);
|
|
res.send(latestCard);
|
|
});
|
|
},
|
|
dates: function(req, res){
|
|
var query = "SELECT DISTINCT(DATE(createdAt)) as date FROM card_history ORDER BY date DESC";
|
|
Card.query(query, function(err, results){
|
|
if (err) return res.serverError(err);
|
|
return res.ok(results);
|
|
});
|
|
}
|
|
|
|
};
|