refactor(auth): Use user_id as JWT sub and implement get_user_by_id

Switched from username to user_id as the primary identifier in JWT tokens to better support external authentication providers. Added get_user_by_id to HistoryManager and updated API dependencies and tests to reflect these changes.
This commit is contained in:
Yunxiao Xu
2026-02-11 16:41:27 -08:00
parent ceddacf9cb
commit b23fbce8d0
9 changed files with 31 additions and 15 deletions

View File

@@ -25,6 +25,11 @@ def test_full_history_workflow(history_manager):
assert user is not None
assert user.display_name == "E2E User"
# 1.1 Verify get_user_by_id
fetched_user = history_manager.get_user_by_id(user.id)
assert fetched_user is not None
assert fetched_user.username == email
# 2. Create Conversation
conv = history_manager.create_conversation(user.id, "nj", "Test Analytics")
assert conv.id is not None