Get user tasks for the past N days
(user_id: str, days: int = 7)
| 1894 | INSERT INTO task_status |
| 1895 | (task_id, task_type, user_id, status, started_at) |
| 1896 | VALUES (?, ?, ?, 'running', CURRENT_TIMESTAMP) |
| 1897 | """, (task_id, task_type, user_id)) |
| 1898 | conn.commit() |
| 1899 | conn.close() |
| 1900 | return cursor.lastrowid |
| 1901 | |
| 1902 | |
| 1903 | def update_task_status( |
| 1904 | task_id: str, |
| 1905 | status: str, |
| 1906 | progress_json: Optional[Dict] = None |
| 1907 | ) -> bool: |
| 1908 | """Update task status""" |
| 1909 | conn = get_connection() |
| 1910 | cursor = conn.cursor() |
| 1911 |