Repository navigation
Add HR/HCM Module: 16 Objects for Complete Employee Lifecycle Management - #84
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR introduces the new @hotcrm/hr Human Capital Management module, defining 16 HR/HCM business objects plus a plugin and exports to cover the full employee lifecycle within HotCRM. It wires the new package into the monorepo tooling (TypeScript, ESLint, lockfile) and adds documentation for usage and capabilities.
Changes:
- Adds the
packages/hrpackage with its ownpackage.json,tsconfig.json, and README describing the HR module. - Implements 16 HR-related object metadata files (employee, department, position, recruitment pipeline, performance, L&D, time & attendance, payroll) plus an
HRPluginand centralindex.tsexports. - Updates
pnpm-lock.yamlto register the newpackages/hrimporter and its dependencies.
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Registers packages/hr as a workspace importer with @hotcrm/core, @objectstack/spec, TypeScript, and ESLint dependencies, aligning it with other packages in the monorepo. |
| packages/hr/tsconfig.json | Configures TypeScript build output and root directory for the HR package, hooking it into the shared base.tsconfig.json. |
| packages/hr/src/training.object.ts | Defines the training object (fields, relationships to certifications, list views, validation rules, and layout) for tracking employee training and learning activities. |
| packages/hr/src/time_off.object.ts | Defines the time_off object covering leave requests, approval workflow fields, list views, and a date-range validation rule. |
| packages/hr/src/recruitment.object.ts | Adds the recruitment object for job requisitions, including headcount, priority, salary range, relationships to applications/interviews, and a salary-range validation rule. |
| packages/hr/src/position.object.ts | Implements the position object to model job roles, levels, salary bands, and relationships to employees and recruitments, with a salary-range validation rule. |
| packages/hr/src/plugin.ts | Introduces HRPlugin, registering all 16 HR objects and defining the navigation groups (Organization, Talent Acquisition, Performance & Development, Time & Payroll). |
| packages/hr/src/performance_review.object.ts | Adds the performance_review object for 360° evaluations, scores/ratings, relationships to goals, list views, and validation for review period and score range. |
| packages/hr/src/payroll.object.ts | Defines the payroll object to represent payroll runs with detailed earnings/deductions, status, payment method, list views, and a pay period validation rule. |
| packages/hr/src/onboarding.object.ts | Implements the onboarding object for new hire onboarding flows, including mentor/manager links, task completion flags, and timeline fields. |
| packages/hr/src/offer.object.ts | Defines the offer object tying candidate, application, recruitment, and position data together with compensation details, expiry logic, onboarding relationship, list views, and validation rules. |
| packages/hr/src/interview.object.ts | Adds the interview object for scheduling and tracking interviews (types, panel, ratings, outcomes) with list views for upcoming, completed, and “my” interviews. |
| packages/hr/src/index.ts | Central export barrel for all HR objects and HRPlugin, providing the public TypeScript surface for @hotcrm/hr. |
| packages/hr/src/goal.object.ts | Implements the goal object for OKRs/personal goals with progress tracking, performance review linkage, validations, and multiple list views. |
| packages/hr/src/employee.object.ts | Defines the core employee master-data object (identity, contact, employment, address, emergency contacts), relationships across HR artifacts, list views, and employment/termination validations. |
| packages/hr/src/department.object.ts | Adds the department object modeling org units, hierarchy, manager, cost center, and relationships to employees, positions, and sub-departments. |
| packages/hr/src/certification.object.ts | Defines the certification object to track employee certifications, linkage to training, expiry/renewal, cost, and a date validation rule. |
| packages/hr/src/candidate.object.ts | Implements the candidate object for applicant information, education, experience, skills (tags), status, relationships to applications/interviews/offers, and list views. |
| packages/hr/src/attendance.object.ts | Adds the attendance object capturing daily check-in/out, work and overtime hours, status, GPS locations, approvals, and list views (today, my attendance, late, absent, overtime). |
| packages/hr/src/application.object.ts | Defines the application object linking candidates to recruitments with pipeline status/stage, referrer info, relationships to interviews, and list views. |
| packages/hr/package.json | Creates the npm manifest for @hotcrm/hr (build/lint scripts, runtime and dev dependencies, metadata), aligning structure with other core packages. |
| packages/hr/README.md | Documents the HR module’s scope, supported objects, and AI enhancement ideas, and shows a basic usage example importing HRPlugin. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
| validationRules: [ | ||
| { | ||
| name: 'ValidDates', | ||
| errorMessage: '结束时间必须在开始时间之后', |
There was a problem hiding this comment.
The validation rule message says that the end time must be after the start time, but the formula only flags cases where end_date is earlier than start_date, allowing equal start/end times. To avoid confusion, either tighten the formula to also treat equal timestamps as invalid or adjust the error message to reflect the actual behavior ("不能早于" rather than "必须在…之后").
| errorMessage: '结束时间必须在开始时间之后', | |
| errorMessage: '结束时间不能早于开始时间', |
| validationRules: [ | ||
| { | ||
| name: 'ValidReviewPeriod', | ||
| errorMessage: '结束日期必须在开始日期之后', |
There was a problem hiding this comment.
The ValidReviewPeriod error message states that the end date must be after the start date, but the formula only rejects cases where end_date is strictly earlier than start_date, so equal dates pass validation. Consider aligning the message and logic by either treating equal dates as invalid in the formula or relaxing the message to say the end date cannot be earlier than the start date.
| errorMessage: '结束日期必须在开始日期之后', | |
| errorMessage: '结束日期不能早于开始日期', |
| formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)' | ||
| }, | ||
| { | ||
| name: 'ValidStartDate', | ||
| errorMessage: '入职日期必须在Offer日期之后', | ||
| formula: 'start_date < offer_date' |
There was a problem hiding this comment.
The expiry-date validation message says the deadline must be after the offer date, but the formula only rejects values where expiry_date is earlier than offer_date, allowing the same date even though it technically isn�t "after". It would be clearer to either tighten the formula to also reject equal dates or rephrase the message to say the expiry date cannot be earlier than the offer date.
| formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)' | |
| }, | |
| { | |
| name: 'ValidStartDate', | |
| errorMessage: '入职日期必须在Offer日期之后', | |
| formula: 'start_date < offer_date' | |
| formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date <= offer_date)' | |
| }, | |
| { | |
| name: 'ValidStartDate', | |
| errorMessage: '入职日期必须在Offer日期之后', | |
| formula: 'start_date <= offer_date' |
| errorMessage: '截止日期必须在Offer日期之后', | ||
| formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)' | ||
| }, | ||
| { | ||
| name: 'ValidStartDate', | ||
| errorMessage: '入职日期必须在Offer日期之后', |
There was a problem hiding this comment.
Similarly, for ValidStartDate, the error message says the start date must be after the offer date, but the formula only flags cases where start_date is earlier than offer_date, so a same-day start is allowed. Please align the wording and condition so users aren�t misled about whether equal dates are permitted.
| errorMessage: '截止日期必须在Offer日期之后', | |
| formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)' | |
| }, | |
| { | |
| name: 'ValidStartDate', | |
| errorMessage: '入职日期必须在Offer日期之后', | |
| errorMessage: '截止日期不得早于Offer日期', | |
| formula: 'AND(NOT(ISBLANK(expiry_date)), expiry_date < offer_date)' | |
| }, | |
| { | |
| name: 'ValidStartDate', | |
| errorMessage: '入职日期不得早于Offer日期', |
| validationRules: [ | ||
| { | ||
| name: 'ValidTerminationDate', | ||
| errorMessage: '离职日期必须在入职日期之后', |
There was a problem hiding this comment.
The ValidTerminationDate rule's message says the termination date must be after the hire date, but the formula only rejects values where termination_date is earlier than hire_date, accepting equal dates despite the wording. To avoid confusion, either treat equal dates as invalid in the formula or change the message to say the termination date cannot be earlier than the hire date.
| errorMessage: '离职日期必须在入职日期之后', | |
| errorMessage: '离职日期不能早于入职日期', |
| const Employee = { | ||
| name: 'employee', |
There was a problem hiding this comment.
This new HR module adds multiple object schemas and a plugin, but there are currently no schema/unit tests for these objects even though similar CRM objects (for example account.object.ts) have dedicated tests as described in packages/TESTING.md. To maintain consistent coverage and catch metadata regressions, please add HR object tests (e.g., validating required fields, relationships, and validation rules) under a packages/hr/__tests__/unit/objects folder.
Description
Implements Phase 2 HR/HCM module (
packages/hr) with 16 business objects covering organizational structure, talent acquisition, performance management, learning & development, and compensation. All objects follow @objectstack/spec v0.8.1+ protocol with snake_case naming convention.Type of Change
Changes Made
Organizational Structure (3 objects)
department.object.ts- Nested hierarchy, cost centers (13 fields, 3 relationships)position.object.ts- Job roles, headcount planning, salary ranges (14 fields, 2 relationships)employee.object.ts- Master data, employment status, emergency contacts (30 fields, 8 relationships)Talent Acquisition Pipeline (6 objects)
recruitment.object.ts- Job requisitions with priority tracking (16 fields)candidate.object.ts- Applicant profiles, skills, education (23 fields)application.object.ts- Pipeline stage management, referral tracking (13 fields)interview.object.ts- Multi-round scheduling, panel feedback, ratings (20 fields)offer.object.ts- Compensation packages, equity, expiry tracking (21 fields)onboarding.object.ts- Task completion, buddy system, probation (19 fields)Performance & Development (4 objects)
performance_review.object.ts- 360° reviews, multi-dimensional ratings (23 fields)goal.object.ts- OKR tracking with progress monitoring (20 fields)training.object.ts- Course management, completion tracking, certification (23 fields)certification.object.ts- Expiry tracking, renewal workflows (18 fields)Time & Compensation (3 objects)
time_off.object.ts- Multi-type leave, approval workflows (19 fields)attendance.object.ts- GPS check-in/out, overtime, location tracking (15 fields)payroll.object.ts- Detailed income/deduction breakdown, multiple payment methods (25 fields)Plugin Architecture
plugin.ts- 4-group navigation structure (Organization, Talent Acquisition, Performance & Development, Time & Payroll)index.ts- Module exports with TypeScript declarationsStatistics: 311 fields, 25 relationships, 59 list views, 14 validation rules across 16 objects
Testing
npm test)npm run lint)npm run build)Validation Results:
Screenshots
N/A - Metadata-only objects without UI implementation
Checklist
Additional Notes
AI Enhancement Ready: Objects designed for future AI features including resume parsing (Candidate), interview question generation (Interview), performance prediction (PerformanceReview), skill gap analysis (Training), and succession planning (Employee relationships).
Field Naming Convention: All fields use lowercase/snake_case per @objectstack/spec v0.7.2+ protocol (e.g.,
employee_id,start_date,base_salary).Validation Fixes: Corrected 7 date comparison formulas post-code review to properly trigger on invalid conditions rather than valid ones (training, time_off, performance_review, payroll, goal, offer, position).
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.