Initial commit: HabitForge - habit tracking application with FastAPI backend, React frontend, and Zepp integration

This commit is contained in:
2026-07-31 08:58:53 -04:00
commit c7fce339c2
124 changed files with 17558 additions and 0 deletions
+51
View File
@@ -0,0 +1,51 @@
import sys
import os
# Add the current directory to sys.path to ensure we can import 'backend'
sys.path.append(os.getcwd())
from backend.database import SessionLocal, engine
from backend import models
def dump_table(session, model, table_name):
print(f"\n{'='*20} {table_name} {'='*20}")
records = session.query(model).all()
if not records:
print("(No data found)")
return
# Get column names
columns = [c.name for c in model.__table__.columns]
# Calculate widths for nice formatting (simple approach)
widths = {col: len(col) for col in columns}
for r in records:
for col in columns:
val = str(getattr(r, col))
widths[col] = max(widths[col], len(val))
# Header
header = " | ".join(f"{col:<{widths[col]}}" for col in columns)
print(header)
print("-" * len(header))
# Rows
for r in records:
row = " | ".join(f"{str(getattr(r, col)):<{widths[col]}}" for col in columns)
print(row)
print(f"Total: {len(records)} records")
def main():
db = SessionLocal()
try:
dump_table(db, models.User, "Users")
dump_table(db, models.Challenge, "Challenges")
dump_table(db, models.Tracking, "Tracking Logs")
dump_table(db, models.DailyHealthMetrics, "Daily Health Metrics")
dump_table(db, models.WorkoutSession, "Workout Sessions")
finally:
db.close()
if __name__ == "__main__":
main()