Spaces:
Sleeping
Sleeping
from sqlalchemy import Column, Integer, String, Text, Boolean, DateTime, ForeignKey | |
from sqlalchemy.orm import relationship | |
from sqlalchemy.sql import func | |
from ..core.database import Base | |
class Subtask(Base): | |
__tablename__ = "subtasks" | |
id = Column(Integer, primary_key=True, index=True) | |
todo_id = Column(Integer, ForeignKey("todos.id"), nullable=False) | |
title = Column(String(255), nullable=False) | |
description = Column(Text, nullable=True) | |
completed = Column(Boolean, default=False, nullable=False) | |
order_index = Column(Integer, default=0) | |
created_at = Column(DateTime(timezone=True), server_default=func.now()) | |
# Relationships | |
todo = relationship("Todo", back_populates="subtasks") | |
class Translation(Base): | |
__tablename__ = "translations" | |
id = Column(Integer, primary_key=True, index=True) | |
todo_id = Column(Integer, ForeignKey("todos.id"), nullable=False) | |
language = Column(String(50), nullable=False) | |
translated_title = Column(String(500), nullable=False) | |
translated_description = Column(Text, nullable=True) | |
created_at = Column(DateTime(timezone=True), server_default=func.now()) | |
# Relationships | |
todo = relationship("Todo", back_populates="translations") |