Browse Source

fix

push-params
Evan Feenstra 4 years ago
parent
commit
b33bb21c27
  1. 3
      dist/src/controllers/index.js
  2. 2
      dist/src/controllers/index.js.map
  3. 3
      src/controllers/index.ts

3
dist/src/controllers/index.js

@ -105,10 +105,11 @@ function set(app) {
}); });
app.get('/latest', function (req, res) { app.get('/latest', function (req, res) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const last = yield models_1.models.Message.findAll({ const lasts = yield models_1.models.Message.findAll({
limit: 1, limit: 1,
order: [['createdAt', 'DESC']] order: [['createdAt', 'DESC']]
}); });
const last = lasts && lasts[0];
console.log('=> last.dataValues', last.dataValues); console.log('=> last.dataValues', last.dataValues);
if (!last) { if (!last) {
res.status(404).send('Not found'); res.status(404).send('Not found');

2
dist/src/controllers/index.js.map

File diff suppressed because one or more lines are too long

3
src/controllers/index.ts

@ -107,10 +107,11 @@ export async function set(app) {
}) })
app.get('/latest', async function(req,res) { app.get('/latest', async function(req,res) {
const last = await models.Message.findAll({ const lasts = await models.Message.findAll({
limit: 1, limit: 1,
order: [[ 'createdAt', 'DESC' ]] order: [[ 'createdAt', 'DESC' ]]
}) })
const last = lasts && lasts[0]
console.log('=> last.dataValues',last.dataValues) console.log('=> last.dataValues',last.dataValues)
if(!last) { if(!last) {
res.status(404).send('Not found'); res.status(404).send('Not found');

Loading…
Cancel
Save