40227-vm/backend/docs/staff-attendance.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.7 KiB

Staff Attendance Backend

Purpose

The staff attendance API provides staff-level attendance records and summary counts for the attendance snapshot and director dashboard.

This workflow is separate from:

  • student-level generated attendance models: attendance_sessions, attendance_records
  • campus daily aggregate summaries: campus_attendance_summaries

Data Model

The module uses:

  • staff_attendance_records

Records include:

  • attendance_date
  • status: present, late, or absent
  • note
  • user_name
  • user_role
  • organizationId
  • campusId
  • userId
  • audit fields and soft delete timestamps

API

All routes require JWT authentication.

  • GET /api/staff_attendance/records
  • GET /api/staff_attendance/records?startDate=<YYYY-MM-DD>&endDate=<YYYY-MM-DD>&limit=<number>
  • GET /api/staff_attendance/summary
  • GET /api/staff_attendance/summary?startDate=<YYYY-MM-DD>&endDate=<YYYY-MM-DD>&limit=<number>

Access Rules

  • Regular staff can read only their own staff attendance records.
  • Report roles can read campus-scoped staff attendance records.
  • Tenant-wide leadership roles can read organization-wide records.
  • Summary includes active staff count from staff plus attendance status counts from staff_attendance_records.

The module currently exposes read/report endpoints only. Add write or import endpoints when the staff attendance source system is defined.

Files

  • backend/src/constants/staff-attendance.js
  • backend/src/db/models/staff_attendance_records.js
  • backend/src/db/migrations/20260608008000-create-staff-attendance-records.js
  • backend/src/services/staff_attendance.js
  • backend/src/routes/staff_attendance.js