- Backend (FastAPI): - Task comments with nested replies and soft delete - @mention parsing with 10-mention limit per comment - Notification system with read/unread tracking - Blocker management with project owner notification - WebSocket endpoint with JWT auth and keepalive - User search API for @mention autocomplete - Alembic migration for 4 new tables - Frontend (React + Vite): - Comments component with @mention autocomplete - NotificationBell with real-time WebSocket updates - BlockerDialog for task blocking workflow - NotificationContext for state management - OpenSpec: - 4 requirements with scenarios defined - add-collaboration change archived 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
27 lines
1.4 KiB
Python
27 lines
1.4 KiB
Python
import uuid
|
|
from sqlalchemy import Column, String, Text, Boolean, DateTime, ForeignKey
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.orm import relationship
|
|
from app.core.database import Base
|
|
|
|
|
|
class Comment(Base):
|
|
__tablename__ = "pjctrl_comments"
|
|
|
|
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
task_id = Column(String(36), ForeignKey("pjctrl_tasks.id", ondelete="CASCADE"), nullable=False)
|
|
parent_comment_id = Column(String(36), ForeignKey("pjctrl_comments.id", ondelete="CASCADE"), nullable=True)
|
|
author_id = Column(String(36), ForeignKey("pjctrl_users.id"), nullable=False)
|
|
content = Column(Text, nullable=False)
|
|
is_edited = Column(Boolean, default=False, nullable=False)
|
|
is_deleted = Column(Boolean, default=False, nullable=False)
|
|
created_at = Column(DateTime, server_default=func.now(), nullable=False)
|
|
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now(), nullable=False)
|
|
|
|
# Relationships
|
|
task = relationship("Task", back_populates="comments")
|
|
author = relationship("User", back_populates="comments")
|
|
parent_comment = relationship("Comment", remote_side=[id], back_populates="replies")
|
|
replies = relationship("Comment", back_populates="parent_comment", cascade="all, delete-orphan")
|
|
mentions = relationship("Mention", back_populates="comment", cascade="all, delete-orphan")
|