Skip to content

feat: Migrate handover.controller to TypeScript (#1326) - #328

Open
Dhruvi2006-source wants to merge 44 commits into
codinggita:mainfrom
Dhruvi2006-source:migrate-handover-controller-1326
Open

feat: Migrate handover.controller to TypeScript (#1326)#328
Dhruvi2006-source wants to merge 44 commits into
codinggita:mainfrom
Dhruvi2006-source:migrate-handover-controller-1326

Conversation

@Dhruvi2006-source

Copy link
Copy Markdown
Contributor

Description

Resolves #1326

Migrates handover.controller.js to TypeScript with strongly typed request and response interfaces, query parameters, and middleware definitions to improve type safety and maintainability across the API boundary.

Key Changes

  1. Controller Migration:

    • Converted handover.controller.js to handover.controller.ts
    • Preserved the existing controller behavior and API functionality
    • Migrated controller logic without changing the existing request flow
  2. Request & Response Types:

    • Added explicit TypeScript interfaces for controller request data
    • Defined response types for successful and error responses
    • Added strict typing for request body and API response structures
  3. Query Parameter Typing:

    • Added typed interfaces for supported query parameters
    • Ensures query values are validated and handled with predictable types
    • Removes implicit any usage across controller query handling
  4. Middleware Type Safety:

    • Added proper Express middleware and request handler types
    • Ensures typed request, response, and next parameters
    • Improves type safety across the handover API boundary
  5. TypeScript Integration:

    • Updated imports and exports to follow the existing TypeScript conventions
    • Resolves JavaScript-specific implicit typing issues introduced during migration
    • Improves compile-time error detection and long-term maintainability

Tests

npm test

Aakif-Kohari and others added 30 commits August 26, 2026 14:08
…fines and the section 5 deadlines (Dev1822#1767)

Six engines write into `payroll.deductions` and each of them is right. Section
7(3) is a rule about their sum, so none of them is in a position to apply it.

The engine therefore takes the whole set: it classifies each row into a section
7(2) clause, takes the section 9 absence out of the base first because those are
wages that were never earned, runs section 8 over the fines before they consume
ceiling headroom, and then abates in the statutory order until the total fits.

Abatement is a deferral, not a waiver, so the balances are written to their own
collection. Provident fund, income tax and court orders are unabatable, and a
set made only of those can exceed the ceiling with nothing lawful to do about
it — that case reports rather than abating something it may not touch.
… untouched

An undefined `approvedActsText` meant the textarea had not been opened, and
sending it as an empty list turns the section 8(1) check off entirely — every
fine becomes lawful because there is no list to fail against.
…rtime asymmetry (Dev1822#1768)

ESI is the only Indian payroll statute whose coverage is decided by a period
rather than by a month, and every mistake made with it follows from treating it
as though it were not.

A raise from ₹20,000 to ₹26,000 in July does not end coverage in July. The
proviso to Rule 50 carries it to 30 September, and those three months are
contributed on ₹26,000 — the wages actually paid. The ceiling is a test for
entry into the scheme; the Act sets no cap on the base.

Underneath it, overtime is excluded from the coverage test and included in the
contribution base, so the same rupee sits on both sides of one line. Neither
fact is representable in a single ESI wage figure or an `esiApplicable` boolean,
which is why the coverage state is stored with the date of the crossing.
…2) bonus and the early-pension reduction (Dev1822#1769)

The formula is one line and both of its inputs are traps.

Pensionable salary is the average of the last sixty months with each month
capped *before* it is averaged. A member on ₹40,000 for fifty-five months who
dropped to ₹9,000 for the last five averages ₹14,500. Average the actual wages
and cap the result and you get ₹15,000 — over-stated, for life, since a pension
once fixed is not revisited. The two orders differ whenever any month in the
window is below the ceiling.

And the window is sixty contributory months, not sixty calendar ones, so a
member with four months of unpaid leave reaches back sixty-four.

The service half keeps eligible and pensionable years as separate numbers, so
the paragraph 10(2) bonus is added after the twenty-year test and can never
satisfy its own threshold.
… ESOP exercise perquisite (Dev1822#1770)

The value of employer-owned accommodation is a percentage of salary, and salary
for Rule 3 includes every taxable allowance. So granting an employee ₹1,000 of
allowance does not add ₹1,000 to their taxable income — it adds ₹1,100, and
nothing that values perquisites from a table can see it, because the dependency
runs the other way.

The order is therefore fixed and stated: assemble the Rule 3 salary with
perquisites excluded, value the accommodation against it, add the value back. A
post-processing step that added the value into the figure it read would feed
itself.

`marginalAllowanceMultiplier` surfaces the compounding as a number, because
`fbpEngine.utils.js` optimises packages today without being able to see it.
…d the unregistered-contract exposure (Dev1822#1771)

The difficulty is not that an apprentice is a cheaper employee. Section 18 says
an apprentice is not a worker, so the same individual is inside the section 8
band and outside the provident fund, ESI, bonus and gratuity headcounts.

Every headcount in the tree is a single number, and each of them would be wrong
about apprentices in a different direction. So `strengthFor` takes the statute
as a required argument and there is no default — a bare headcount would be right
for one caller and silently wrong for the next.

The obligation with teeth is registration. A contract not registered within
thirty days is not an apprenticeship: the person was an ordinary employee for
the period, and the exposure is exactly the size of the exclusions section 18
allowed the establishment to take.
`deriveComposition` never existed; the function is `resolveComposition`, and
the flag it sets is `recorded` rather than `derived`.
…of-wages

feat(wages): the section 7(3) aggregate deduction ceiling, section 8 fines and the section 5 deadlines (Dev1822#1767)
…ribution

feat(esi): contribution periods, the Rule 50 continuation and the overtime asymmetry (Dev1822#1768)
…oyee-id

feat: add employee ID copy button
feat(eps): capped-then-averaged pensionable salary, the paragraph 10(2) service bonus and the early-pension reduction (Dev1822#1769)
…-user-journeys

test: add critical end-to-end user journeys
…nce-benchmarks

test: add autocannon API performance benchmarks
…-storage-to-s3

feat: migrate file storage to AWS S3
…ilds

ci: optimize workflows with matrix builds
…te-valuation

feat(perquisites): Rule 3 valuation, the frozen SBI loan rate and the ESOP exercise perquisite (Dev1822#1770)
…ceship-compliance

feat(apprentices): the section 8 engagement band, Rule 11 stipends and the unregistered-contract exposure (Dev1822#1771)
chore: enforce code formatting with husky and lint-staged
…owledgment

- CompanyPolicy model with versioning, categories, department assignments, and soft delete
- PolicyAcknowledgment model tracking employee read-receipts per policy version
- Full CRUD controller: create, list, view, update, publish versions, delete
- Employee acknowledgment flow with duplicate prevention and department filtering
- Admin analytics: per-policy acknowledgment stats with completion rates
- Zod validation schemas for create, publish, and status-change payloads
- Mounted at /api/policies with RBAC-gated admin routes and auth employee routes
- Controller unit tests covering all critical paths

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
… employee views

- HolidayCalendar controller with full CRUD for calendars and individual holidays
- Supports global, department-level, and location-level calendar assignments
- Employee endpoints: upcoming holidays, date-range queries, and stats
- Zod validation schemas for calendar creation and holiday addition
- Mounted at /api/holiday-calendars with RBAC-gated admin routes
- Controller unit tests covering all critical paths

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
dipanshubatra and others added 14 commits August 27, 2026 09:25
…tracking, and document verification

- Complete rewrite of basic onboarding stub with 14 endpoints
- Plan management: create, list, view, update, delete with task template CRUD
- Start onboarding: instantiate plan tasks for new employees with due date calculation
- Task tracking: status updates (Pending/In Progress/Completed/Blocked) with audit trail
- Progress overview: per-employee completion percentage and active onboardings dashboard
- Document management: upload, verify/reject with rejection reason tracking
- Zod validation schemas for plan creation and onboarding triggers
- Controller unit tests covering all critical paths

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
…ployee enrollment

- BenefitPlan model with categories, premiums, employer/employee contributions, and enrollment windows
- BenefitEnrollment model tracking employee selections, dependents, and monthly deductions
- Full controller: plan CRUD, employee enrollment with capacity and window checks, cancel/re-enroll
- Admin views: all enrollments overview, per-plan stats with utilization rates, HR termination
- Employee views: my enrollments with plan details, enrollment with dependent management
- Zod validation schemas for plan creation and enrollment with strict field rejection
- Controller unit tests covering all critical paths

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
…dance tracking

- CompanyEvent model with categories, recurrence, virtual meeting support, and capacity limits
- EventRSVP model tracking going/maybe/not-going responses with check-in timestamps
- Full controller: event CRUD, RSVP with capacity checks, check-in, attendee lists, and analytics
- Monthly calendar view with filtering by category, upcoming, and search
- Event analytics: department breakdown, no-show tracking, and attendance rates
- Zod validation schemas for event creation and RSVP with strict field rejection
- Controller unit tests covering all critical paths

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
…licy-management

feat(company-policies): add company policy management & employee ackn…
…ocument-management

feat(holiday-calendar): add holiday calendar management with CRUD and…
…nboarding-checklist

feat(onboarding): rewrite onboarding controller with plan CRUD, task …
…nefits-enrollment

feat(benefits): add company benefits enrollment with plan CRUD and em…
…eferral-system

feat(events): add company event & social calendar with RSVP and atten…
…year-end-magnetic-media

feat: implement automated W-2/W-3 year-end generation and SSA magnetic media engine (closes Dev1822#1757)
…-hsa-engine

feat: implement FSA and HSA pre-tax contribution, limit tracking, and run-out period engine (closes Dev1822#1758)
Copilot AI lite review requested due to automatic review settings August 27, 2026 10:55

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

8 participants