30 lines
862 B
Python
30 lines
862 B
Python
import sys
|
|
import os
|
|
import logging
|
|
|
|
# Add backend to path
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
|
|
|
from src.services.postgresql_manager import PostgreSQLManager
|
|
from src.services.sync_app import SyncApp
|
|
from src.services.garmin.client import GarminClient
|
|
from src.utils.config import config
|
|
|
|
logging.basicConfig(level=logging.INFO)
|
|
logger = logging.getLogger(__name__)
|
|
|
|
def main():
|
|
logger.info("Starting stream backfill...")
|
|
db_manager = PostgreSQLManager(config.DATABASE_URL)
|
|
|
|
with db_manager.get_db_session() as session:
|
|
# Client not needed for local reparse but SyncApp requires it
|
|
client = GarminClient()
|
|
app = SyncApp(session, client)
|
|
|
|
result = app.activity_sync.reparse_local_files()
|
|
logger.info(f"Backfill complete: {result}")
|
|
|
|
if __name__ == "__main__":
|
|
main()
|