HRM Module
The HRM (Human Resource Management) module provides comprehensive employee and organizational management capabilities. It enables organizations to manage their workforce, track employee information, assign positions, and maintain organizational structure.
Overview
The HRM module enables organizations to:
- Manage employees with complete personal and professional information
- Define and assign positions within the organization
- Track employment history including hire dates and resignation dates
- Manage employee metadata such as languages, tax identifiers, and personal documents
- Maintain salary and compensation information
- Support multi-language employee communication preferences
Key Concepts
Employees
An employee represents a person employed by the organization. Each employee has:
Core Information:
ID: Unique employee identifier (numeric)TenantID: Multi-tenant isolationFirstName,LastName,MiddleName: Name componentsEmail: Employee email (unique per tenant)Phone: Contact phone number
Professional Details:
HireDate: Employment start dateResignationDate: Optional employment end dateSalary: Monthly/periodic compensation amountHourlyRate: Hourly rate for hourly employeesCoefficient: Calculation coefficient for compensation
Personal Information:
BirthDate: Date of birthAvatarID: Reference to employee photo
Identifiers & Documents:
Tin: Tax Identification Number (TIN)Pin: Personal Identification Number (PIN)Passport: Passport document referenceLanguages: Primary and secondary language preferences
Notes & Metadata:
Notes: Additional employee information
Positions
A position represents a role or job title within the organization. Positions can be:
Attributes:
ID: Unique position identifier (numeric)TenantID: Multi-tenant isolationName: Position title (unique per tenant)Description: Role responsibilities and requirementsCreatedAt / UpdatedAt: Temporal tracking
Employee-Position Assignment
Employees can be assigned to one or more positions, enabling:
- Role-based organization
- Clear responsibility assignment
- Flexible position assignment
- Support for multiple roles
Module Architecture
modules/hrm/
├── domain/
│ ├── aggregates/
│ │ └── employee/
│ │ ├── employee.go # Employee aggregate interface
│ │ ├── employee_impl.go # Implementation
│ │ ├── employee_repository.go # Repository interface
│ │ ├── employee_events.go # Domain events
│ │ ├── employee_create_dto.go # Creation DTO
│ │ ├── employee_update_dto.go # Update DTO
│ │ └── language_impl.go # Language value object
│ └── entities/
│ └── position/
│ ├── position.go # Position entity
│ ├── position_repository.go # Repository interface
│ └── position_impl.go # Implementation
├── infrastructure/
│ ├── persistence/
│ │ ├── employee_repository.go # PostgreSQL implementation
│ │ ├── position_repository.go # Position persistence
│ │ ├── hrm_mappers.go # Domain <-> Persistence mapping
│ │ ├── models/
│ │ │ └── models.go # Persistence models
│ │ └── queries/
│ └── providers/
├── services/
│ ├── employee_service.go # Business logic for employees
│ └── position_service.go # Business logic for positions
├── presentation/
│ ├── controllers/
│ │ ├── employee_controller.go # HTTP handlers
│ │ └── position_controller.go
│ ├── viewmodels/
│ │ └── viewmodels.go # Data transformation
│ ├── templates/pages/
│ │ └── employees/ # Employee UI
│ ├── mappers/
│ │ └── mappers.go # DTO transformations
│ ├── locales/
│ │ ├── en.toml
│ │ ├── ru.toml
│ │ └── uz.toml
│ └── forms/ # Form DTOs
├── permissions/
│ └── constants.go # RBAC permissions
├── links.go # Module route registration
└── module.go # Module initialization
Integration Points
With Finance Module
- Employee salary information integrated with payroll
- Compensation tracking and reporting
- Currency support for salary amounts
With Core Module
- Multi-tenant support with tenant isolation
- User accounts linked to employees
- RBAC for HR operations
- Audit logging for changes
With Passport Module
- Passport document references
- Legal identification tracking
- Compliance and verification
Event Bus
Employees module publishes domain events for:
- Employee creation, update, and deletion
- Position assignments
- Status changes (resignation, etc.)
Common Tasks
Creating an Employee
- Prepare employee information (name, email, hire date, etc.)
- Create create DTO with employee details
- Call
EmployeeService.Create(ctx, dto) - System assigns unique employee ID
- Publishes
EmployeeCreatedEvent
Assigning Positions
- Ensure position exists in organization
- Link employee to position
- Track assignment history
- Update organizational structure
Managing Employee Status
- Track hire date (employment start)
- Set resignation date when employee leaves
- Update system with status changes
- Maintain historical records
Querying Employees
EmployeeService.GetAll()- All employees for tenantEmployeeService.GetPaginated()- Paginated results with filteringEmployeeService.GetByID()- Specific employee details
Permissions
The HRM module enforces role-based access control:
hrm.view- View employees and positionshrm.create- Create new employeeshrm.edit- Modify employee detailshrm.delete- Remove employeeshrm.export- Export employee datahrm.positions.manage- Manage positionshrm.bulk- Bulk operations
Documentation Structure
- Business Requirements - Problem statement, workflows, and business rules
- Technical Architecture - Implementation details, patterns, and API contracts
- Data Model - Database schema, ERD diagrams, and relationships
Next Steps
Explore the Business Requirements to understand HR workflows and constraints, then review Technical Architecture for implementation details.