codecombat/server/analytics/analytics_users_active_handler.coffee
Matt Lott e3abb9ceb3 Capture active user metrics
Watching for these events:
Level completed
User registered
Playtime of 30s in a level
Purchase
Payment
Subscribe
Earned an achievement
2014-12-04 12:57:57 -08:00

16 lines
487 B
CoffeeScript

AnalyticsUsersActive = require './AnalyticsUsersActive'
Handler = require '../commons/Handler'
class AnalyticsUsersActiveHandler extends Handler
modelClass: AnalyticsUsersActive
jsonSchema: require '../../app/schemas/models/analytics_users_active'
hasAccess: (req) ->
req.method in ['GET'] or req.user?.isAdmin()
makeNewInstance: (req) ->
instance = super(req)
instance.set('creator', req.user._id)
instance
module.exports = new AnalyticsUsersActiveHandler()