Add bot id to subscriptions
This commit is contained in:
parent
b92e3c9b30
commit
6e3d23e740
3 changed files with 25 additions and 3 deletions
|
|
@ -48,6 +48,7 @@ Subscriptions.schema = new SimpleSchema({
|
|||
geo: LocationSchema,
|
||||
distance: Number,
|
||||
chatId: { type: Number, optional: true }, // only in 'telegram' type
|
||||
telegramBot: { type: String, optional: true }, // only in 'telegram' type
|
||||
owner: String,
|
||||
type: String,
|
||||
createdAt: defaultCreatedAt,
|
||||
|
|
|
|||
|
|
@ -106,7 +106,6 @@ const schemaUser = new SimpleSchema({
|
|||
'name.first': String,
|
||||
'name.last': String, */
|
||||
lang: { type: String, optional: true },
|
||||
telegramBot: { type: String, optional: true },
|
||||
telegramChatId: { type: SimpleSchema.Integer, optional: true },
|
||||
telegramUsername: { type: String, optional: true },
|
||||
telegramFirstName: { type: String, optional: true },
|
||||
|
|
|
|||
|
|
@ -171,12 +171,34 @@ Meteor.startup(() => {
|
|||
$set: {
|
||||
telegramBot: 'es'
|
||||
}
|
||||
});
|
||||
}, { multi: true });
|
||||
}
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 13,
|
||||
up: function removeTelegramBotFromUsersId() {
|
||||
Meteor.users.update({}, {
|
||||
$unset: {
|
||||
telegramBot: ''
|
||||
}
|
||||
}, { multi: true });
|
||||
}
|
||||
});
|
||||
|
||||
Migrations.add({
|
||||
version: 14,
|
||||
up: function setTelegramUsersBotId() {
|
||||
UserSubsToFiresCollection.update({ chatId: { $ne: null }, telegramBot: null }, {
|
||||
$set: {
|
||||
telegramBot: 'es'
|
||||
}
|
||||
}, { multi: true });
|
||||
}
|
||||
});
|
||||
|
||||
// Set createdAt in users & subs
|
||||
Migrations.migrateTo('latest');
|
||||
|
||||
// Migrations.migrateTo('12,rerun');
|
||||
// Migrations.migrateTo('14,rerun');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue