import uuid from typing import TYPE_CHECKING from sqlalchemy import Boolean, ForeignKey, JSON, String, Text from sqlalchemy import Uuid as UUID from sqlalchemy.orm import Mapped, mapped_column, relationship from src.models.base import Base, TimestampMixin, UUIDPrimaryKeyMixin if TYPE_CHECKING: from src.models.user import User class ConfigFolder(UUIDPrimaryKeyMixin, TimestampMixin, Base): __tablename__ = "config_folders" user_id: Mapped[uuid.UUID] = mapped_column( UUID(), ForeignKey("users.id", ondelete="CASCADE"), nullable=False ) name: Mapped[str] = mapped_column(String(255), nullable=False) description: Mapped[str | None] = mapped_column(Text, nullable=True) mount_path: Mapped[str] = mapped_column(String(1024), nullable=False) files: Mapped[dict] = mapped_column( JSON, default=dict, nullable=False ) # {"relative/path": "content", ...} project_overrides: Mapped[dict | None] = mapped_column( JSON, default=dict, nullable=True ) # {"project_id": {"mount_path": "...", "files": {...}}} is_active: Mapped[bool] = mapped_column(Boolean, default=True, nullable=False) user: Mapped["User"] = relationship()