feat: Include admin user name in SoundPlayed records for enhanced tracking
Some checks failed
Backend CI / lint (push) Successful in 16m41s
Backend CI / test (push) Failing after 47m14s

This commit is contained in:
JSC
2025-08-02 18:22:38 +02:00
parent 4bbae4c5d4
commit 77446cb5a8

View File

@@ -264,8 +264,10 @@ class VLCPlayerService:
# This could be refined to track per-user play history # This could be refined to track per-user play history
admin_user = await user_repo.get_by_id(1) admin_user = await user_repo.get_by_id(1)
admin_user_id = None admin_user_id = None
admin_user_name = None
if admin_user: if admin_user:
admin_user_id = admin_user.id admin_user_id = admin_user.id
admin_user_name = admin_user.name
# Always create a new SoundPlayed record for each play event # Always create a new SoundPlayed record for each play event
sound_played = SoundPlayed( sound_played = SoundPlayed(
@@ -288,6 +290,7 @@ class VLCPlayerService:
"sound_id": sound_id, "sound_id": sound_id,
"sound_name": sound_name, "sound_name": sound_name,
"user_id": admin_user_id, "user_id": admin_user_id,
"user_name": admin_user_name,
"play_count": (old_count + 1) if sound else None, "play_count": (old_count + 1) if sound else None,
} }
await socket_manager.broadcast_to_all("sound_played", event_data) await socket_manager.broadcast_to_all("sound_played", event_data)