Skip to content

Feature: Clean payroll implementation (isolated, aligned with current main)#319

Open
LoopyB wants to merge 2 commits intomainfrom
louisa/feature/payroll-clean
Open

Feature: Clean payroll implementation (isolated, aligned with current main)#319
LoopyB wants to merge 2 commits intomainfrom
louisa/feature/payroll-clean

Conversation

@LoopyB
Copy link
Copy Markdown
Collaborator

@LoopyB LoopyB commented Apr 28, 2026

Overview

This PR reimplements the payroll feature on a clean branch aligned with the current main branch.

The previous payroll implementation became stale and conflicted with recent backend changes. This version resolves that by scoping changes strictly to payroll functionality.


Scope (Intentionally Limited)

Only the following files were modified:

  • models/Payroll.js (new)
  • services/payroll.service.js
  • controllers/payroll.controller.js
  • routes/payroll.routes.js
  • middleware/logger.js (minimal additions)
  • package.json / package-lock.json (pdfkit)

No changes were made to:

  • auth / OTP / email logic
  • notifications
  • RBAC / roles
  • messages
  • Shift / ShiftAttendance / User models

Features Implemented

  • Payroll generation from completed shifts
  • Attendance-aware hour calculation with fallback to scheduled hours
  • Daily overtime (>8h) and weekly overtime (>38h, Monday-based)
  • CSV export
  • PDF export
  • Approve payroll (bulk)
  • Process payroll (bulk)

API Endpoints

  • GET /api/v1/payroll
  • GET /api/v1/payroll/export?format=csv|pdf
  • POST /api/v1/payroll/approve
  • POST /api/v1/payroll/process

Validation Performed

  • Payroll generation returns correct totals
  • CSV export returns valid file
  • PDF export returns valid file
  • Approve → status transitions to APPROVED
  • Process → status transitions to PROCESSED

Notes

  • OTP/email functionality was not modified and is working via SMTP as expected
  • Console OTP fallback remains available only if email fails (existing behaviour)

Context

This implementation avoids modifying unrelated backend systems to prevent regression and ensure stability.

It would be beneficial to review/merge this while it remains aligned with main to avoid the previous stale-branch conflict scenario.


get-payroll-200
csv-export-200
pdf-export-200
approve-200
process-200

@uppalkrish
Copy link
Copy Markdown
Collaborator

PLEASE SHOW ME API RUNNING ON SWAGGER

@LoopyB
Copy link
Copy Markdown
Collaborator Author

LoopyB commented May 8, 2026

Hi Krish,

I’ve added Swagger validation screenshots for the clean payroll PR.

Validated through Swagger:

  • GET /api/v1/payroll returns 200 with generated payroll summary
  • GET /api/v1/payroll/export?format=csv returns 200 and downloads CSV
  • POST /api/v1/payroll/approve returns 200 and updates status to APPROVED
  • POST /api/v1/payroll/process returns 200 and updates status to PROCESSED

Screenshots attached.

api-v1-payroll api-v1-payroll-approve api-v1-payroll-exportCSV api-v1-payroll-process ---

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.

2 participants