diff --git a/src/api/models/sw-subscription.ts b/src/api/models/sw-subscription.ts index ecca04cb91..235c801c7d 100644 --- a/src/api/models/sw-subscription.ts +++ b/src/api/models/sw-subscription.ts @@ -1,3 +1,13 @@ +import * as mongo from 'mongodb'; import db from '../../db/mongodb'; -export default db.get('sw_subscriptions') as any; // fuck type definition +const SwSubscription = db.get('swSubscriptions'); +export default SwSubscription; + +export interface ISwSubscription { + _id: mongo.ObjectID; + userId: mongo.ObjectID; + endpoint: string; + auth: string; + publickey: string; +} diff --git a/tools/migration/shell.camel-case.js b/tools/migration/shell.camel-case.js index 533868cdc4..9cb0baaaf5 100644 --- a/tools/migration/shell.camel-case.js +++ b/tools/migration/shell.camel-case.js @@ -187,3 +187,10 @@ db.signin.update({}, { user_id: 'userId', } }, false, true); + +db.sw_subscriptions.renameCollection('swSubscriptions'); +db.swSubscriptions.update({}, { + $rename: { + user_id: 'userId', + } +}, false, true);