@@ -27,7 +27,7 @@ class EventSinkService {
2727 val userService : UserService = DI .injector.getInstance(classOf [UserService ])
2828 val appConfig : AppConfigurationService = DI .injector.getInstance(classOf [AppConfigurationService ])
2929
30- // Fetch directly from config on demand
30+ // UNUSED: Fetch directly from config on demand
3131 def getGoogleAnalytics (): String = Play .configuration.getString(EventSinkService .GA_CONFIG_KEY ).getOrElse(" " )
3232 def getAmplitudeApiKey (): String = Play .configuration.getString(EventSinkService .AMPLITUDE_CONFIG_KEY ).getOrElse(" " )
3333 def getMongoAuth (): String = Play .configuration.getString(EventSinkService .AMPLITUDE_CONFIG_KEY ).getOrElse(" " )
@@ -51,14 +51,23 @@ class EventSinkService {
5151 messageService.submit(exchangeName, queueName, metadata, " fanout" )
5252 }
5353
54- // TODO: Call this when admin changes configuration via the UI
55- def syncAuthInfo () = {
56- Logger .info(" Synchronizing event sink consumer auth" )
57- logEvent(" auth_sync" , Json .obj(
58- " amplitude" -> getAmplitudeApiKey(),
59- " google_analytics" -> getGoogleAnalytics(),
60- " influx" -> getInfluxAuth(),
61- " mongo" -> getMongoAuth()
54+ /** Log an event when user signs up */
55+ def logUserSignupEvent (user : User ) = {
56+ Logger .info(" New user signed up: " + user.id.stringify)
57+ logEvent(" user_activity" , Json .obj(
58+ " type" -> " signup" ,
59+ " user_id" -> user.id,
60+ " user_name" -> user.fullName
61+ ))
62+ }
63+
64+ /** Log an event when user logs in */
65+ def logUserLoginEvent (user : User ) = {
66+ Logger .info(" User logged in: " + user.id.stringify)
67+ logEvent(" user_activity" , Json .obj(
68+ " type" -> " login" ,
69+ " user_id" -> user.id,
70+ " user_name" -> user.fullName
6271 ))
6372 }
6473
0 commit comments