added new "last message" logic, before useReducer

This commit is contained in:
canove
2020-06-17 09:03:44 -03:00
parent 794a217a4e
commit 48ee6385d3
9 changed files with 140 additions and 85 deletions

View File

@@ -0,0 +1,15 @@
const Whatsapp = require("../models/whatsapp");
exports.getSession = async (req, res, next) => {
try {
const dbSession = await Whatsapp.findOne({ where: { id: 1 } });
if (!dbSession) {
return res.status(200).json({ message: "Session not found" });
}
return res.status(200).json(dbSession);
} catch (err) {
next(err);
}
};