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>
66 lines
2.3 KiB
Markdown
66 lines
2.3 KiB
Markdown
# Campus Attendance Backend
|
|
|
|
## Purpose
|
|
|
|
The campus attendance API stores campus attendance system links and manually entered daily campus attendance summaries.
|
|
|
|
The current CampusAttendance UI uses daily aggregate totals, not student-level attendance sessions. Student-level attendance remains in the existing generated `attendance_sessions` and `attendance_records` models.
|
|
|
|
## Data Model
|
|
|
|
The module uses:
|
|
|
|
- `campus_attendance_config`
|
|
- `campus_attendance_summaries`
|
|
|
|
Both tables include:
|
|
|
|
- `organizationId` for tenant ownership.
|
|
- `campus_key` for the approved UI campus keys: `tigers`, `gators`, `hawks`, `owls`, `wildcats`, `grizzlies`.
|
|
- nullable `campusId` for future linkage to persisted campus rows.
|
|
- audit fields and soft delete timestamps.
|
|
|
|
## API
|
|
|
|
All routes require JWT authentication.
|
|
|
|
- `GET /api/campus_attendance/configs`
|
|
- `GET /api/campus_attendance/configs?campusKey=<campusKey>`
|
|
- `PUT /api/campus_attendance/configs/:campusKey`
|
|
- `GET /api/campus_attendance/summaries`
|
|
- `GET /api/campus_attendance/summaries?campusKey=<campusKey>&startDate=<YYYY-MM-DD>&endDate=<YYYY-MM-DD>`
|
|
- `PUT /api/campus_attendance/summaries/:campusKey/:date`
|
|
|
|
## Access Rules
|
|
|
|
- Tenant-wide leadership roles can read all campus config and summary records.
|
|
- Campus-scoped users can read their own campus when their backend campus name/code maps to an approved `campus_key`.
|
|
- Attendance manager roles can update links and daily summaries.
|
|
- The frontend does not send organization, campus UUID, creator, updater, or recorded-by labels. The backend derives them from the authenticated user.
|
|
|
|
## Data Contract
|
|
|
|
Config mutation fields:
|
|
|
|
- `attendance_link`
|
|
|
|
Summary mutation fields:
|
|
|
|
- `total_enrolled`
|
|
- `total_present`
|
|
- `total_absent`
|
|
- `total_tardy`
|
|
- `notes`
|
|
|
|
The backend calculates `attendance_percentage` from `total_present / total_enrolled`. The frontend displays the backend-calculated value.
|
|
|
|
## Files
|
|
|
|
- `backend/src/constants/campus-attendance.js`
|
|
- `backend/src/db/models/campus_attendance_config.js`
|
|
- `backend/src/db/models/campus_attendance_summaries.js`
|
|
- `backend/src/db/migrations/20260608006000-create-campus-attendance-config.js`
|
|
- `backend/src/db/migrations/20260608007000-create-campus-attendance-summaries.js`
|
|
- `backend/src/services/campus_attendance.js`
|
|
- `backend/src/routes/campus_attendance.js`
|