codecombat/server/analytics/analytics_log_event_handler.coffee

21 lines
524 B
CoffeeScript
Raw Normal View History

2014-12-15 14:45:12 -05:00
AnalyticsLogEvent = require './AnalyticsLogEvent'
Handler = require '../commons/Handler'
class AnalyticsLogEventHandler extends Handler
modelClass: AnalyticsLogEvent
jsonSchema: require '../../app/schemas/models/analytics_log_event'
editableProperties: [
'event'
'properties'
]
hasAccess: (req) ->
2014-12-17 00:45:17 -05:00
req.method in ['POST'] or req.user?.isAdmin()
2014-12-15 14:45:12 -05:00
makeNewInstance: (req) ->
instance = super(req)
instance.set('user', req.user._id)
instance
module.exports = new AnalyticsLogEventHandler()