- 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>
38 lines
1.3 KiB
Python
38 lines
1.3 KiB
Python
import uuid
|
|
from sqlalchemy import Column, String, Text, Boolean, DateTime, ForeignKey, Enum
|
|
from sqlalchemy.sql import func
|
|
from sqlalchemy.orm import relationship
|
|
from app.core.database import Base
|
|
import enum
|
|
|
|
|
|
class NotificationType(str, enum.Enum):
|
|
MENTION = "mention"
|
|
ASSIGNMENT = "assignment"
|
|
BLOCKER = "blocker"
|
|
STATUS_CHANGE = "status_change"
|
|
COMMENT = "comment"
|
|
BLOCKER_RESOLVED = "blocker_resolved"
|
|
|
|
|
|
class Notification(Base):
|
|
__tablename__ = "pjctrl_notifications"
|
|
|
|
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()))
|
|
user_id = Column(String(36), ForeignKey("pjctrl_users.id", ondelete="CASCADE"), nullable=False)
|
|
type = Column(
|
|
Enum("mention", "assignment", "blocker", "status_change", "comment", "blocker_resolved",
|
|
name="notification_type_enum"),
|
|
nullable=False
|
|
)
|
|
reference_type = Column(String(50), nullable=False)
|
|
reference_id = Column(String(36), nullable=False)
|
|
title = Column(String(200), nullable=False)
|
|
message = Column(Text, nullable=True)
|
|
is_read = Column(Boolean, default=False, nullable=False)
|
|
created_at = Column(DateTime, server_default=func.now(), nullable=False)
|
|
read_at = Column(DateTime, nullable=True)
|
|
|
|
# Relationships
|
|
user = relationship("User", back_populates="notifications")
|