overleaf/services/web/app/coffee/Features/Subscription/UserFeaturesUpdater.coffee

13 lines
414 B
CoffeeScript
Raw Normal View History

2014-02-12 05:23:40 -05:00
logger = require("logger-sharelatex")
User = require('../../models/User').User
module.exports =
updateFeatures: (user_id, features, callback = (err, features)->)->
2014-02-12 05:23:40 -05:00
conditions = _id:user_id
update = {}
logger.log user_id:user_id, features:features, "updating users features"
update["features.#{key}"] = value for key, value of features
2014-02-12 05:23:40 -05:00
User.update conditions, update, (err)->
callback err, features
2014-02-12 05:23:40 -05:00