40227-vm/frontend/docs/staff-support-pages.md

86 lines
5.3 KiB
Markdown

# Staff Support Pages
## Purpose
The Autism Support Steps, Certifications & Degrees, and Awards Earned & Reviews pages were adapted from the legacy `education-support-management` template into the current three-layer frontend.
## Frontend Layers
View:
- `frontend/src/pages/modules/AutismSupportStepsPage.tsx`
- `frontend/src/pages/modules/ParaCertificationsPage.tsx`
- `frontend/src/pages/modules/AwardsReviewsPage.tsx`
- `frontend/src/components/frameworks/AutismSupportSteps.tsx`
- `frontend/src/components/frameworks/ParaCertifications.tsx`
- `frontend/src/components/frameworks/AwardsReviews.tsx`
Business:
- `frontend/src/business/staff-support/hooks.ts`
- `frontend/src/business/staff-support/selectors.ts`
API/data:
- `frontend/src/shared/api/contentCatalog.ts`
- `frontend/src/shared/api/staffAwardsReviews.ts`
- `frontend/src/shared/api/files.ts`
- `frontend/src/shared/types/staffSupport.ts`
## Backend Contracts
Autism Support Steps:
- Reads `GET /api/content-catalog/read/autism-support-steps`.
- Managers update `PUT /api/content-catalog/autism-support-steps`.
- Visual card images upload through `POST /api/file/upload/autism-support/visual-cards`.
- Payload shape is `steps` plus `visualCards`. Step cards store `id`, `iconId`, `title`, `subtitle`, and `spans`. Visual cards store `id`, `label`, optional `imageUrl`, and fallback `iconText`.
- The page renders normal read-only cards by default. Users with management access get a collapsed `Edit Content` panel for step cards and printable lanyard cards.
- `Print Steps` prints the staff step cards; `Print Lanyards` prints the visual cards using the same payload.
Certifications & Degrees:
- Reads `GET /api/content-catalog/read/para-certifications`.
- Managers update `PUT /api/content-catalog/para-certifications`.
- Hero image uploads through `POST /api/file/upload/para-certifications/hero`.
- Payload shape is `heroImage`, `heroTitle`, `heroSubtitle`, `highlights`, and `programs`.
- Highlight cards store `id`, `iconId`, `title`, and `subtitle`. Program cards store `id`, `name`, `organization`, `description`, `url`, and `tag`.
- The page renders normal read-only cards by default. Users with management access get a collapsed `Edit Content` panel for the hero, highlights, and certification cards.
Awards Earned & Reviews:
- Reads records through `GET /api/staff_awards_reviews`.
- Managers list visible staff through `GET /api/staff_awards_reviews/staff`.
- Creates, updates, and deletes records through `POST /`, `PUT /:id`, and `DELETE /:id`.
- Attachments upload through `POST /api/file/upload/staff-awards-reviews/attachments`.
- Staff users see only their own records and a collapsed add/edit form.
- Leaders and office managers with management permission see a staff list first; selecting a staff member loads that staff member's records and enables cross-staff create/update/delete.
## Access
- Route visibility is driven by `READ_AUTISM_SUPPORT_STEPS`, `READ_PARA_CERTIFICATIONS`, and `READ_AWARDS_REVIEWS`.
- Content management is driven by `MANAGE_AUTISM_SUPPORT_STEPS` and `MANAGE_PARA_CERTIFICATIONS`, and is enabled only at campus effective scope.
- Awards/reviews self-service is available to readers for their own records. Cross-staff staff list and mutation require `MANAGE_AWARDS_REVIEWS`; backend scope checks decide which staff are visible.
- Campus staff readers are `director`, `office_manager`, `teacher`, and `support_staff` through seeded preset permissions. Leaders (`owner`, `superintendent`, `principal`) access the pages through scope drilling and the same permission names.
- `registrar` is intentionally not granted these pages.
## Data Ownership
- Autism Support Steps and Certifications & Degrees content belongs in backend `content_catalog` seed payloads and campus-scoped content rows.
- Awards/reviews records belong in `staff_awards_reviews`, not `user_progress`, because leaders can maintain records for scoped staff users.
- Uploaded images/files are stored in the shared file subsystem; payloads and rows store only the returned private URLs.
## Seeded Defaults
- `backend/src/db/seeders/content-catalog-data/content-catalog-seed-payloads.ts` contains the default Autism Support Steps and Certifications & Degrees payloads.
- `backend/src/db/seeders/20260608103000-content-catalog.ts` includes those payloads for standard seeding.
- `ContentCatalogSeedService.seedDefaultContentForTenant` creates campus-scoped rows for every new campus so new organizations see the legacy template content immediately.
- `backend/src/db/seeders/20260613060000-staff-awards-reviews.ts` seeds demo and rival teacher/support-staff award/review records, so seeded staff pages are not empty by default.
## Tests
- `frontend/src/business/staff-support/selectors.test.ts` covers payload normalization for Autism Support Steps and Certifications & Degrees.
- `frontend/src/shared/api/staffAwardsReviews.test.ts` covers Awards Earned & Reviews API route construction and mutation payloads.
- `frontend/src/business/app-shell/selectors.test.ts` covers sidebar visibility for the three staff-support modules across organization, school, campus, and class effective scopes.
- Backend behavior is covered by `backend/src/services/content_catalog.test.ts`, `backend/src/services/content_catalog_seed.test.ts`, `backend/src/services/staff_awards_reviews.test.ts`, and `backend/src/db/seeders/user-roles.test.ts`.