Spaces:
Running
Running
| from sqlalchemy import ( | |
| Column, String, Boolean, DateTime, Integer, | |
| Float, Text, Date, Index | |
| ) | |
| from sqlalchemy.sql import func | |
| from .base import Base | |
| class Project(Base): | |
| __tablename__ = "projects" | |
| id = Column(Integer, primary_key=True) | |
| project_id = Column(String(36), unique=True, nullable=False, index=True) | |
| user_hash = Column(String(64), nullable=False, index=True) | |
| tenant_id = Column(String(64), nullable=True, index=True) | |
| title = Column(String(200), nullable=False) | |
| objective = Column(Text) | |
| project_type = Column(String(30)) | |
| # savings | debt | tax | payroll | budget | compliance | other | |
| status = Column(String(20), default="active") | |
| # active | paused | completed | cancelled | |
| # Financial targets | |
| target_amount = Column(Float) | |
| current_amount = Column(Float, default=0) | |
| target_date = Column(Date) | |
| # Living summary | |
| summary = Column(Text) | |
| open_questions = Column(Text, default="[]") | |
| key_decisions = Column(Text, default="[]") | |
| next_action = Column(Text) | |
| # Linked items | |
| linked_files = Column(Text, default="[]") | |
| linked_chat_sessions = Column(Text, default="[]") | |
| # Timestamps | |
| created_at = Column(DateTime, server_default=func.now()) | |
| updated_at = Column(DateTime, onupdate=func.now()) | |
| last_active = Column(DateTime, server_default=func.now()) | |
| __table_args__ = ( | |
| Index("ix_projects_user", "user_hash"), | |
| Index("ix_projects_status", "status"), | |
| Index("ix_projects_tenant", "tenant_id"), | |
| Index("ix_projects_last_active", "last_active"), | |
| ) | |