mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-01-26 17:12:00 +00:00
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
from sqlalchemy import Column, Integer, String, DateTime, Text
|
|
from sqlalchemy.orm import declarative_base
|
|
from datetime import datetime
|
|
|
|
Base = declarative_base()
|
|
|
|
class ActivityDownload(Base):
|
|
__tablename__ = "activity_downloads"
|
|
|
|
activity_id = Column(Integer, primary_key=True, index=True)
|
|
source = Column(String, default="garmin-connect")
|
|
file_path = Column(String, unique=True, index=True)
|
|
file_format = Column(String)
|
|
status = Column(String, default="success") # success, failed
|
|
http_status = Column(Integer, nullable=True)
|
|
etag = Column(String, nullable=True)
|
|
last_modified = Column(DateTime, nullable=True)
|
|
size_bytes = Column(Integer, nullable=True)
|
|
checksum_sha256 = Column(String, nullable=True)
|
|
downloaded_at = Column(DateTime, default=datetime.utcnow)
|
|
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
|
error_message = Column(Text, nullable=True)
|
|
|
|
def __repr__(self):
|
|
return f"<ActivityDownload(activity_id={self.activity_id}, status='{self.status}', file_path='{self.file_path}')>" |