mirror of
https://github.com/sstent/FitTrack_GarminSync.git
synced 2026-01-27 01:22:03 +00:00
feat: Add files from examples/Garmin_Analyser
This commit is contained in:
25
examples/Garmin_Analyser/db/models.py
Normal file
25
examples/Garmin_Analyser/db/models.py
Normal file
@@ -0,0 +1,25 @@
|
||||
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}')>"
|
||||
Reference in New Issue
Block a user