mirror of
https://github.com/sstent/AICyclingCoach.git
synced 2026-01-26 09:02:30 +00:00
change to TUI
This commit is contained in:
@@ -3,7 +3,7 @@ from .route import Route
|
||||
from .section import Section
|
||||
from .rule import Rule
|
||||
from .plan import Plan
|
||||
from .plan_rule import PlanRule
|
||||
from .plan_rule import plan_rules
|
||||
from .user import User
|
||||
from .workout import Workout
|
||||
from .analysis import Analysis
|
||||
|
||||
BIN
backend/app/models/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/analysis.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/analysis.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/base.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/base.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/garmin_sync_log.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/garmin_sync_log.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/plan.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/plan.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/plan_rule.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/plan_rule.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/prompt.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/prompt.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/route.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/route.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/rule.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/rule.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/section.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/section.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/user.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/user.cpython-313.pyc
Normal file
Binary file not shown.
BIN
backend/app/models/__pycache__/workout.cpython-313.pyc
Normal file
BIN
backend/app/models/__pycache__/workout.cpython-313.pyc
Normal file
Binary file not shown.
@@ -1,4 +1,5 @@
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, JSON, Boolean, DateTime, func
|
||||
from datetime import datetime
|
||||
from sqlalchemy import Column, Integer, String, ForeignKey, JSON, Boolean, DateTime
|
||||
from sqlalchemy.orm import relationship
|
||||
from .base import BaseModel
|
||||
|
||||
@@ -13,7 +14,7 @@ class Analysis(BaseModel):
|
||||
suggestions = Column(JSON)
|
||||
approved = Column(Boolean, default=False)
|
||||
created_plan_id = Column(Integer, ForeignKey('plans.id'))
|
||||
approved_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
approved_at = Column(DateTime, default=datetime.utcnow) # Changed from server_default=func.now()
|
||||
|
||||
# Relationships
|
||||
workout = relationship("Workout", back_populates="analyses")
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
from datetime import datetime
|
||||
from uuid import UUID, uuid4
|
||||
from sqlalchemy import Column, DateTime
|
||||
from sqlalchemy import Column, Integer, DateTime
|
||||
from sqlalchemy.ext.declarative import declarative_base
|
||||
from sqlalchemy.dialects.postgresql import UUID as PG_UUID
|
||||
|
||||
Base = declarative_base()
|
||||
|
||||
class BaseModel(Base):
|
||||
__abstract__ = True
|
||||
|
||||
id = Column(PG_UUID(as_uuid=True), primary_key=True, default=uuid4)
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
created_at = Column(DateTime, default=datetime.utcnow)
|
||||
updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
|
||||
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
from sqlalchemy import Column, Integer, ForeignKey
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from sqlalchemy import Column, Integer, ForeignKey, JSON
|
||||
from sqlalchemy.orm import relationship
|
||||
from .base import BaseModel
|
||||
|
||||
class Plan(BaseModel):
|
||||
__tablename__ = "plans"
|
||||
|
||||
jsonb_plan = Column(JSONB, nullable=False)
|
||||
jsonb_plan = Column(JSON, nullable=False) # Changed from JSONB to JSON for SQLite compatibility
|
||||
version = Column(Integer, nullable=False)
|
||||
parent_plan_id = Column(Integer, ForeignKey('plans.id'), nullable=True)
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
from sqlalchemy import Column, Integer, ForeignKey
|
||||
from sqlalchemy.orm import relationship
|
||||
from .base import BaseModel
|
||||
from sqlalchemy import Column, Integer, ForeignKey, Table
|
||||
from .base import Base
|
||||
|
||||
class PlanRule(BaseModel):
|
||||
__tablename__ = "plan_rules"
|
||||
|
||||
plan_id = Column(Integer, ForeignKey('plans.id'), primary_key=True)
|
||||
rule_id = Column(Integer, ForeignKey('rules.id'), primary_key=True)
|
||||
|
||||
plan = relationship("Plan", back_populates="rules")
|
||||
rule = relationship("Rule", back_populates="plans")
|
||||
# Association table for many-to-many relationship between plans and rules
|
||||
plan_rules = Table(
|
||||
'plan_rules', Base.metadata,
|
||||
Column('plan_id', Integer, ForeignKey('plans.id'), primary_key=True),
|
||||
Column('rule_id', Integer, ForeignKey('rules.id'), primary_key=True)
|
||||
)
|
||||
@@ -1,7 +1,12 @@
|
||||
from .base import BaseModel
|
||||
from sqlalchemy import Column, String
|
||||
from sqlalchemy.orm import relationship
|
||||
from .base import BaseModel
|
||||
|
||||
class User(BaseModel):
|
||||
__tablename__ = "users"
|
||||
|
||||
plans = relationship("Plan", back_populates="user")
|
||||
username = Column(String(100), nullable=False, unique=True)
|
||||
email = Column(String(255), nullable=True)
|
||||
|
||||
# Note: Relationship removed as Plan model doesn't have user_id field
|
||||
# plans = relationship("Plan", back_populates="user")
|
||||
Reference in New Issue
Block a user