feat: Migrate handover.controller to TypeScript (#1326) - #328
Open
Dhruvi2006-source wants to merge 44 commits into
Open
feat: Migrate handover.controller to TypeScript (#1326)#328Dhruvi2006-source wants to merge 44 commits into
Dhruvi2006-source wants to merge 44 commits into
Conversation
…c media engine (closes Dev1822#1757)
… run-out period engine (closes Dev1822#1758)
…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>
…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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Resolves #1326
Migrates
handover.controller.jsto 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
Controller Migration:
handover.controller.jstohandover.controller.tsRequest & Response Types:
Query Parameter Typing:
anyusage across controller query handlingMiddleware Type Safety:
nextparametersTypeScript Integration:
Tests
npm test