40227-vm/backend/docs/communications.md
Dmitri d4a5378adf Refactor: migrate frontend to Vite/React, add product backend modules
Frontend:
- Replace Next.js with Vite + React + TypeScript
- Add new component architecture (app-shell, sidebar, dashboard modules)
- Implement product modules: FRAME, safety protocols, walkthrough checkin,
  campus/staff attendance, personality quiz, sign language, classroom timer
- Add shadcn/ui component library with Tailwind CSS
- Remove legacy generated components, stores, and pages

Backend:
- Add product migrations: frame_entries, user_progress, safety_quiz_results,
  walkthrough_checkins, communication_events, personality_quiz_results,
  campus_attendance_config/summaries, staff_attendance_records, content_catalog
- Add corresponding models, services, and routes
- Implement cookie-based auth with refresh token rotation
- Add content catalog seeder with product content
- Migrate to ESLint flat config
- Switch from yarn to npm

Infrastructure:
- Update .gitignore for new tooling
- Add project documentation (CLAUDE.md, docs/)
- Remove deprecated config files and yarn.lock

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-06-09 15:18:23 +02:00

1.5 KiB

Communications Backend

Purpose

The communications API provides product-focused endpoints for parent messages and internal alerts without exposing the generated CRUD routes directly to the frontend workflow.

Parent messages reuse existing backend tables:

  • messages
  • message_recipients

Internal alerts use:

  • communication_events

API

All routes require JWT authentication.

  • GET /api/communications/parent-messages: returns parent messages created by the current user.
  • GET /api/communications/parent-messages?category=<category>: filters the current user's parent messages by category.
  • POST /api/communications/parent-messages: creates one sent parent message and recipient log.
  • GET /api/communications/events: returns internal alert events visible to the current user's organization and campus scope.
  • GET /api/communications/events?type=<type>: filters events by type.
  • POST /api/communications/events: creates one internal alert event.

Access Rules

  • Authenticated tenant users can create and list their own parent-message logs.
  • Communication manager roles can create internal alert events.
  • Tenant-wide roles can list all organization events.
  • Campus-scoped users list events for their campus when a campus is available on their profile.

Data Contract

Parent message create fields:

  • recipientName
  • messageText
  • category

Event create fields:

  • title
  • date
  • type
  • roles

The frontend does not send organization, campus, creator, or updater fields. The backend fills them from the authenticated user.