"keep data on the server" opt-in/out
This commit is contained in:
+10
-3
@@ -9,7 +9,7 @@ from __future__ import annotations
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, Optional
|
||||
|
||||
# ── Shared constants (imported by edit/server.py and serve/server.py) ─────────
|
||||
|
||||
@@ -58,13 +58,20 @@ def apply_sidecar_edit(activity_id: str, payload: dict[str, Any], data_dir: Path
|
||||
merge_one(data_dir, activity_id)
|
||||
|
||||
|
||||
def run_strava_sync(data_dir: Path, client_id: str, client_secret: str) -> dict[str, Any]:
|
||||
def run_strava_sync(
|
||||
data_dir: Path,
|
||||
client_id: str,
|
||||
client_secret: str,
|
||||
originals_dir: Optional[Path] = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Fetch new Strava activities and write them into data_dir.
|
||||
|
||||
Args:
|
||||
data_dir: Per-user data directory.
|
||||
client_id: Strava OAuth client ID.
|
||||
client_secret: Strava OAuth client secret.
|
||||
originals_dir: If set, raw Strava API data (meta + streams) is saved here
|
||||
as JSON files for potential future reprocessing.
|
||||
|
||||
Returns:
|
||||
Dict with keys: ok, imported, skipped, error_count, errors.
|
||||
@@ -75,7 +82,7 @@ def run_strava_sync(data_dir: Path, client_id: str, client_secret: str) -> dict[
|
||||
from bincio.extract.ingest import strava_sync as _strava_sync
|
||||
from bincio.render.merge import merge_all
|
||||
|
||||
result = _strava_sync(data_dir, client_id, client_secret)
|
||||
result = _strava_sync(data_dir, client_id, client_secret, originals_dir=originals_dir)
|
||||
if result["imported"]:
|
||||
merge_all(data_dir)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user