Migrate from moment to date-fns and some changes

This commit is contained in:
canove
2020-07-06 18:21:08 -03:00
parent 1bc4831f8f
commit 3679c94baa
33 changed files with 430 additions and 12010 deletions

View File

@@ -0,0 +1,22 @@
const Whatsapp = require("../models/Whatsapp");
const { getIO } = require("../libs/socket");
const { getWbot, init } = require("./wbot");
exports.getSession = async (req, res, next) => {
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);
};
exports.getContacts = async (req, res, next) => {
const io = getIO();
const wbot = getWbot();
const phoneContacts = await wbot.getContacts();
return res.status(200).json(phoneContacts);
};