Browse Source

postgres is strict about variable type

feature/telegramLogin
Nareshkumar Rao 3 years ago
parent
commit
9a73fb0662
  1. 13
      app.js

13
app.js

@ -60,13 +60,10 @@ Contact.sync();
const User = sequelize.define('User', { const User = sequelize.define('User', {
telegram: { telegram: {
type: DataTypes.STRING,
type: DataTypes.INTEGER,
allowNull: false, allowNull: false,
unique: true, unique: true,
}, },
hash: {
type: STRING,
},
verification: { verification: {
type: DataTypes.STRING, type: DataTypes.STRING,
}, },
@ -185,7 +182,10 @@ function addContact(telegram, withUserID, done) {
Contact.create({ user: user.id, with: withUserID }) Contact.create({ user: user.id, with: withUserID })
.then(res => { .then(res => {
console.log(`Registering contact between ${user.id} and ${withUserID}`); console.log(`Registering contact between ${user.id} and ${withUserID}`);
sendTelegramMessage(withUser.telegram, "Someone scanned your QR code. You will be notified if they are tested positive with Covid. If you are tested positive, please tell this bot /COVIDPOSITIVE");
sendTelegramMessage(withUser.telegram,
"Someone scanned your QR code. You will be notified if they are tested positive with Covid. If you are tested positive, please tell this bot /COVIDPOSITIVE",
() => {}
);
done(true, "Successfully added contact"); done(true, "Successfully added contact");
}) })
.catch(e => { .catch(e => {
@ -243,9 +243,6 @@ app.use(express.json())
setTelegramWebHook(() => {}); setTelegramWebHook(() => {});
app.post(`/${process.env.TELEGRAM_SECRET}`, (req, res) => { app.post(`/${process.env.TELEGRAM_SECRET}`, (req, res) => {
if (req.body.message) {
sendTelegramMessage(req.body.message.chat.id, `${req.body.message.text.toUpperCase()}`, (res) => { console.log(res) });
}
res.send(); res.send();
}); });

Loading…
Cancel
Save