30 lines
818 B
Python
30 lines
818 B
Python
#!/usr/bin/env python3
|
|
"""
|
|
Sync script to fetch and store projects in Firestore
|
|
This can be run manually from the command line to update the projects collection
|
|
"""
|
|
|
|
import sys
|
|
import os
|
|
|
|
# Add the current directory to the Python path so we can import app
|
|
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|
|
|
from app import fetch_all_projects
|
|
|
|
def main():
|
|
"""Main function to fetch and sync projects"""
|
|
print("Starting project sync...")
|
|
try:
|
|
# Fetch all projects and store them in Firestore
|
|
projects = fetch_all_projects()
|
|
print(f"Successfully synced {len(projects)} projects to Firestore")
|
|
except Exception as e:
|
|
print(f"Error during sync: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
sys.exit(1)
|
|
|
|
if __name__ == "__main__":
|
|
main() |