Browse Source

postgres is strict about variable type

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

15
app.js

@ -60,13 +60,10 @@ Contact.sync();
const User = sequelize.define('User', {
telegram: {
type: DataTypes.STRING,
type: DataTypes.INTEGER,
allowNull: false,
unique: true,
},
hash: {
type: STRING,
},
verification: {
type: DataTypes.STRING,
},
@ -185,7 +182,10 @@ function addContact(telegram, withUserID, done) {
Contact.create({ user: user.id, with: withUserID })
.then(res => {
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");
})
.catch(e => {
@ -241,11 +241,8 @@ app.use(session({
app.use(cors({ credentials: true, origin: true, secure: true }));
app.use(express.json())
setTelegramWebHook(() => { });
setTelegramWebHook(() => {});
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();
});

Loading…
Cancel
Save