Update user profile
(user_id: str, profile_json: Dict)
| 684 | |
| 685 | |
| 686 | def update_profile(user_id: str, profile_json: Dict) -> bool: |
| 687 | """Update user profile""" |
| 688 | conn = get_connection() |
| 689 | cursor = conn.cursor() |
| 690 | cursor.execute(""" |
| 691 | UPDATE profiles |
| 692 | SET profile_json = ?, version = ?, updated_at = CURRENT_TIMESTAMP |
| 693 | WHERE user_id = ? |
| 694 | """, (json.dumps(profile_json), profile_json.get("version", "0.1"), user_id)) |
| 695 | conn.commit() |
| 696 | conn.close() |
| 697 | return True |
| 698 | |
| 699 | |
| 700 | def get_profile_history(user_id: str, days: int = 7) -> List[Dict]: |