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>
1.9 KiB
1.9 KiB
Personality Quiz Results Backend
Purpose
The personality quiz results API stores each authenticated staff user's current EI/personality quiz result and exposes aggregate distribution data for leadership reporting.
The workflow uses a dedicated tenant-owned table:
personality_quiz_results
It does not update staff profile records. Staff profile extension should be handled as a separate schema decision if the product later needs personality type on the staff profile itself.
API
All routes require JWT authentication.
GET /api/personality_quiz_results/me: returns the current user's saved result ornull.PUT /api/personality_quiz_results/me: creates or updates the current user's saved result.GET /api/personality_quiz_results/distribution: returns aggregate counts by personality type for authorized report roles.GET /api/personality_quiz_results/distribution?campusId=<campusId>: filters aggregate counts by campus when provided.
Access Rules
- Authenticated tenant users can read and update only their own result.
- Director, superintendent, and mapped backend leadership roles can read aggregate distributions.
- Distribution endpoints return counts only. They do not expose individual staff names or individual answers.
- Organization, campus, user, creator, and updater fields are derived from the authenticated backend user.
Data Contract
Result mutation fields:
personalityTypequizAnswers
The backend validates that personalityType is present and that quizAnswers is an object. The frontend sends answer maps through the typed API layer; the backend stores them as JSON.
Files
backend/src/constants/personality.jsbackend/src/db/models/personality_quiz_results.jsbackend/src/db/migrations/20260608005000-create-personality-quiz-results.jsbackend/src/services/personality_quiz_results.jsbackend/src/routes/personality_quiz_results.js