Files
AutonetSellCar/backend/generate_pdf.py
AutonetSellCar Deploy 1f0dcb1ddb Initial commit: AutonetSellCar platform with deployment system
- Frontend: Next.js 14 with TypeScript
- Backend: FastAPI with SQLAlchemy
- Agent: Carmodoo sync agent
- Deployment: Docker Compose based staging/production setup
- Scripts: Automated deployment with rollback support

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 13:24:39 +09:00

44 lines
1.3 KiB
Python

"""Generate PDF for performance checks"""
import asyncio
import sqlite3
import os
import sys
sys.path.insert(0, r'D:\Workspace\claudeCode\AutonetSellCar.com\backend')
os.chdir(r'D:\Workspace\claudeCode\AutonetSellCar.com\backend')
from app.services.pdf_service import capture_performance_check_pdf
async def generate_pdfs():
conn = sqlite3.connect('autonet.db')
cursor = conn.cursor()
# Get records without PDF
cursor.execute("""
SELECT car_id, check_number FROM car_performance_checks
WHERE check_number IS NOT NULL AND check_number != ''
AND (pdf_path IS NULL OR pdf_path = '')
""")
records = cursor.fetchall()
print(f"Found {len(records)} records to generate PDF")
for car_id, check_number in records:
print(f"\nGenerating PDF for Car ID: {car_id}, Check#: {check_number}")
pdf_path = await capture_performance_check_pdf(check_number, car_id)
if pdf_path:
print(f" SUCCESS: {pdf_path}")
# Update database
cursor.execute("UPDATE car_performance_checks SET pdf_path = ? WHERE car_id = ?", (pdf_path, car_id))
conn.commit()
else:
print(f" FAILED")
conn.close()
print("\nDone!")
if __name__ == "__main__":
asyncio.run(generate_pdfs())