Files
egg 599802b818 feat: Add Chat UX improvements with notifications and @mention support
- Add ActionBar component with expandable toolbar for mobile
- Add @mention functionality with autocomplete dropdown
- Add browser notification system (push, sound, vibration)
- Add NotificationSettings modal for user preferences
- Add mention badges on room list cards
- Add ReportPreview with Markdown rendering and copy/download
- Add message copy functionality with hover actions
- Add backend mentions field to messages with Alembic migration
- Add lots field to rooms, remove templates
- Optimize WebSocket database session handling
- Various UX polish (animations, accessibility)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-12-08 08:20:37 +08:00

4.6 KiB

chat-room Spec Delta

REMOVED Requirements

Requirement: Room Templates

The system SHALL support predefined room templates for common incident types to streamline room creation with preset metadata and initial members.

Reason for removal: 功能未被使用,前端 UI 未實作模板選擇功能,預設模板中的 email 地址不存在於實際 AD 系統。

Scenario: Create room from template (REMOVED)

  • This scenario is removed along with the requirement

ADDED Requirements

Requirement: LOT Batch Number Tracking

The system SHALL support tracking multiple LOT (batch numbers) associated with each incident room. LOT information helps identify affected product batches for quality traceability and recall purposes.

Scenario: Create room with LOT numbers

  • WHEN an authenticated user sends POST /api/rooms with body:
    {
      "title": "Quality Issue on Line 3",
      "incident_type": "quality_issue",
      "severity": "high",
      "location": "Building A",
      "lots": ["LOT-2024-001", "LOT-2024-002"]
    }
    
  • THEN the system SHALL create the room with the provided LOT numbers
  • AND store lots as a JSON array in the database
  • AND return the room details including the lots array

Scenario: Create room without LOT numbers

  • WHEN an authenticated user creates a room without specifying lots
  • THEN the system SHALL create the room with an empty lots array
  • AND allow lots to be added later via update

Scenario: Update room LOT numbers

  • WHEN an authenticated user with editor or owner role sends PATCH /api/rooms/{room_id} with:
    {
      "lots": ["LOT-2024-001", "LOT-2024-002", "LOT-2024-003"]
    }
    
  • THEN the system SHALL replace the existing lots with the new array
  • AND update last_updated_at timestamp
  • AND return the updated room details

Scenario: Add single LOT to existing room

  • WHEN an authenticated user with editor or owner role sends POST /api/rooms/{room_id}/lots with:
    {
      "lot": "LOT-2024-004"
    }
    
  • THEN the system SHALL append the LOT to the existing lots array
  • AND prevent duplicate LOT entries
  • AND return the updated lots array

Scenario: Remove single LOT from room

  • WHEN an authenticated user with editor or owner role sends DELETE /api/rooms/{room_id}/lots/{lot_id}
  • THEN the system SHALL remove the specified LOT from the array
  • AND return the updated lots array

Scenario: Viewer cannot modify LOT numbers

  • WHEN a user with viewer role attempts to update LOT numbers
  • THEN the system SHALL return status 403 with "Insufficient permissions"

Scenario: LOT numbers displayed in room details

  • WHEN a user sends GET /api/rooms/{room_id}
  • THEN the response SHALL include the lots array
  • AND lots SHALL be returned in the order they were added

MODIFIED Requirements

Requirement: Create Incident Room

The system SHALL allow authenticated users to create a new incident room with metadata including title, incident type, severity level, location, description, and optional LOT batch numbers. Each room SHALL be assigned a unique identifier and timestamp upon creation.

Scenario: Create room with LOT numbers

  • WHEN an authenticated user sends POST /api/rooms with body:
    {
      "title": "Line 3 Conveyor Belt Stopped",
      "incident_type": "equipment_failure",
      "severity": "high",
      "location": "Building A, Line 3",
      "description": "Conveyor belt motor overheating, production halted",
      "lots": ["LOT-2024-001"]
    }
    
  • THEN the system SHALL create a new incident_rooms record with:
    • Unique room_id (UUID)
    • Provided metadata fields including lots
    • Status set to "active"
    • created_by set to current user's ID
    • created_at timestamp
  • AND automatically add the creator as a room member with "owner" role
  • AND return status 201 with the room details including room_id and lots

Requirement: Update Room Status and Metadata

The system SHALL allow room owners and editors to update room metadata including LOT batch numbers, and allow owners to transition room status through its lifecycle (active -> resolved -> archived).

Scenario: Update room metadata with LOT

  • WHEN a room owner sends PATCH /api/rooms/{room_id} with:
    {
      "severity": "critical",
      "description": "Updated: Fire hazard detected",
      "lots": ["LOT-2024-001", "LOT-2024-002"]
    }
    
  • THEN the system SHALL update only the provided fields including lots
  • AND record the update in room_activity log
  • AND set last_updated_at timestamp