Description
Use the app's existing EventEmitterModule (already configured in app.module.ts) to emit xp_awarded / user_leveled_up events from the users module, then add a listener in analytics that persists them to AnalyticsEvent. Prefer emitting events over calling the analytics service directly, to avoid tight coupling between users and analytics.
Why this matters
Analytics is only useful if activity in users actually reaches the event log; this is the instrumentation step for that module.
Files to touch
backend/src/users/providers/xp-level.service.ts
backend/src/analytics/listeners/users-analytics.listener.ts
backend/src/analytics/analytics.module.ts
Acceptance Criteria
Notes
This issue is part of the new analytics module effort (tracking, aggregation,
and reporting on player/game activity). Please keep new code inside
backend/src/analytics/ following the same module/controller/service/provider
layout used by existing modules (e.g. progress, streak, quests).
Description
Use the app's existing
EventEmitterModule(already configured inapp.module.ts) to emitxp_awarded / user_leveled_upevents from theusersmodule, then add a listener in analytics that persists them toAnalyticsEvent. Prefer emitting events over calling the analytics service directly, to avoid tight coupling betweenusersandanalytics.Why this matters
Analytics is only useful if activity in
usersactually reaches the event log; this is the instrumentation step for that module.Files to touch
backend/src/users/providers/xp-level.service.tsbackend/src/analytics/listeners/users-analytics.listener.tsbackend/src/analytics/analytics.module.tsAcceptance Criteria
xp_awardedevent is emitted at the correct point in the users flowanalyticspersists the event with relevant metadata (userId, timestamp, entity id)Notes
This issue is part of the new
analyticsmodule effort (tracking, aggregation,and reporting on player/game activity). Please keep new code inside
backend/src/analytics/following the same module/controller/service/providerlayout used by existing modules (e.g.
progress,streak,quests).