OHA Communication System

Complete relational communication architecture

📊 Schema Update

Updated CommunicationLog entity with player relationships:

  • playerId (required) — Links to Player entity
  • playerName — Display name
  • communicationType — email, call, meeting, note
  • subject — Subject/purpose (required)
  • messageBody — Full message content
  • status — sent, completed, follow_up, unlinked
  • relatedCoach — Coach involved (optional)
  • relatedTeam — Team involved (optional)

📝 Logging Workflow

LogCommunicationModal component:

  • ✓ Searchable player dropdown (real-time search)
  • ✓ Auto-fills playerId when player selected
  • ✓ Required: Player, Type, Subject
  • ✓ Optional: Coach, Team, Message, Notes
  • ✓ Available in: Player Profile, Communications Hub

🔗 Auto-Linking

Function: autoLinkCommunicationsToPlayers

  • ✓ Scans unlinked communication records
  • ✓ Matches player names in subject/notes fields
  • ✓ Auto-populates playerId and isAutoLinked flag
  • ✓ Marks unmatched as status: "unlinked"
  • ✓ Admin-only trigger

👤 Player Communication Hub

In PlayerProfile page:

  • ✓ Unified timeline of all player communications
  • ✓ Aggregates: CommunicationLog + RecruitingEmails
  • ✓ Chronologically sorted (newest first)
  • ✓ Rich icons, status badges, previews
  • ✓ "Log Communication" button (pre-fills player)
  • ✓ "Send Email" button (recruiting)
  • ✓ Only visible to authorized agents/admins

🌍 Global Communications Log

Component: GlobalCommunicationsLog

  • ✓ View ALL player communications across platform
  • ✓ Search by player, coach, subject, team
  • ✓ Filter by type (email, call, meeting, note)
  • ✓ Filter by status (sent, completed, follow-up, unlinked)
  • ✓ Status color-coding
  • ✓ Available in: CommunicationsHub, CRM Dashboards

⚙️ Email Integration

Function: syncRecruitingEmailToCommLog

  • ✓ When recruiting email sent, auto-create CommLog entry
  • ✓ Automatically links to player via playerId
  • ✓ Appears in player Communication Hub immediately
  • ✓ Updates status when coach replies
  • ✓ Visible in both Player Hub + Global Log

🔄 Key Workflows

1. Log a Coach Call

Open player profile → "Log Communication" → Select type "call" → Save → Appears in timeline

2. Send Recruiting Email

Open player profile → "Send Email" → Compose → Send → Auto-creates CommLog entry

3. Auto-Link Old Communications

Admin triggers function → Scans unlinked records → Matches player names → Updates playerId

4. View All Communications

Open GlobalCommunicationsLog → Search/filter → See all player communications across platform

✅ Verification Checklist

  • ✓ Log communication → Appears in player timeline immediately
  • ✓ Send email → Auto-creates CommLog entry with playerId
  • ✓ Both views reference same CommunicationLog entity
  • ✓ Chronological sorting works correctly
  • ✓ Search/filter functionality operational
  • ✓ Auto-link function matches existing records
  • ✓ Unmatched records marked as "unlinked"
  • ✓ Permission checks enforce access control

📦 Components & Functions

Components:

  • • LogCommunicationModal.jsx
  • • PlayerCommunicationHub.jsx (updated)
  • • GlobalCommunicationsLog.jsx

Backend Functions:

  • • autoLinkCommunicationsToPlayers.js
  • • syncRecruitingEmailToCommLog.js

Pages Updated:

  • • PlayerProfile
  • • CommunicationsHub