Skip to content

Refactor attendance logic into service layer#413

Merged
LoopyB merged 1 commit into
mainfrom
louisabest/refactor/attendance-service-recovery
Jul 13, 2026
Merged

Refactor attendance logic into service layer#413
LoopyB merged 1 commit into
mainfrom
louisabest/refactor/attendance-service-recovery

Conversation

@LoopyB

@LoopyB LoopyB commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

Reimplements the useful attendance refactor from PR #361 against current main.

Changes

  • Added attendance.service.js
  • Moved check-in, check-out, assignment validation, duplicate detection, location validation, and attendance history lookup out of the controller
  • Updated attendance handling to use the current schema fields:
    • guardId
    • shiftId
    • checkInTime
    • checkOutTime
    • siteLocation.coordinates
  • Preserved assignment behaviour through acceptedBy / assignedGuard
  • Added controlled handling for invalid shift IDs
  • Kept the controller thin by delegating attendance logic to the service layer

Validation

  • Targeted ESLint passed
  • Attendance Jest suite passed: 7 tests
  • Backend started successfully
  • GET /api/v1/health returned HTTP 200
  • git diff --check passed

Scope

No payroll, seed-data, emergency, frontend, or Guard App files were changed.

Supersedes PR #361.

@LoopyB
LoopyB merged commit df54482 into main Jul 13, 2026
0 of 2 checks passed
@LoopyB
LoopyB deleted the louisabest/refactor/attendance-service-recovery branch July 13, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant