Appearance
HR Service
The HR service is the Human Resources module of Microtec ERP. It lives in a separate Git repository (MicrotecHR) and is deployed as an independent microservice (HR.Apis) on the Private CAE.
Repository Overview
| Item | Value |
|---|---|
| Repo | MicrotecHR |
| Solution | Microtec.Hr.Personnel.sln |
| Architecture | Clean Architecture — 4 projects |
| CAE placement | Private CAE |
| Backend prefix | mic-erp-be |
| NuGet strategy | MicrotecDlls (see below) |
Project Structure
MicrotecHR/
├── Microtec.Hr.Personnel.Api/ # REST controllers, startup
│ ├── Controllers/ # 27 controllers
│ ├── Program.cs
│ ├── appsettings.json
│ └── Dockerfile
├── Microtec.Hr.Personnel.Application/ # CQRS handlers, DTOs, validators
│ ├── Employees/
│ ├── Departments/
│ ├── Contracts/
│ ├── PayrollRun/
│ └── ...
├── Microtec.Hr.Personnel.Domain/ # Domain entities, enums, value objects
├── Microtec.Hr.Personnel.Infrastructure/# EF Core, repositories, migrations
├── MicrotecDlls/ # Shared DLLs (not NuGet feed)
├── General files/ # Postman collections
└── Documentation/
└── ExceptionCodes.MDMicrotecDlls: Shared Libraries Strategy
Not from NuGet Feed
The HR service does not consume Microtec.Domain, Microtec.Persistence, or Microtec.Web.Core from the private NuGet feed. Instead, it references the compiled DLLs directly from the MicrotecDlls/ folder.
This means:
- When shared packages are updated, the DLLs in
MicrotecDlls/must be manually updated. - The
.csprojfiles use local entries pointing toMicrotecDlls/. - No PAT or NuGet feed configuration is required for the HR repo.
API Modules
The HR service exposes 27 controllers covering the full HR lifecycle:
Employee Management
| Controller | Route prefix | Key Operations |
|---|---|---|
EmployeesController | /Employees | CRUD, activation, reporting |
DepartmentsController | /Departments | CRUD, hierarchy |
JobsController | /Jobs | CRUD, job catalogue |
WorkLocationsController | /WorkLocations | CRUD, site management |
BranchController | /Branch | Branch lookup |
CompanyController | /Company | Company settings |
Leave Management
| Controller | Route prefix | Key Operations |
|---|---|---|
LeaveTypesController | /LeaveTypes | Leave type catalogue |
LeaveSettingsController | /LeaveSettings | Leave policy per employee type |
LeaveRequestsController | /LeaveRequests | Submit, approve, reject leave requests |
LeaveClearanceController | /LeaveClearance | Annual leave settlement |
Contracts & Salary
| Controller | Route prefix | Key Operations |
|---|---|---|
ContractsController | /Contracts | Create, activate, renew, upgrade contracts |
SalaryTemplatesController | /SalaryTemplates | Salary structure templates |
SalariesItemsController | /SalariesItems | Individual salary line items |
JobAllowancesController | /JobAllowances | Job-linked allowances |
Payroll
| Controller | Route prefix | Key Operations |
|---|---|---|
PayrollRunController | /PayrollRun | Execute and manage payroll runs |
PayrollActionController | /PayrollAction | Post, reverse payroll actions |
PayrollPaymentController | /PayrollPayment | Payment recording and reconciliation |
Loans
| Controller | Route prefix | Key Operations |
|---|---|---|
LoanTypesController | /LoanTypes | Loan product catalogue |
LoanRequestsController | /LoanRequests | Employee loan requests |
EmployeeLoansController | /EmployeeLoans | Active loan tracking, instalment schedule |
Regulatory & Configuration
| Controller | Route prefix | Key Operations |
|---|---|---|
OfficialHolidaysController | /OfficialHolidays | Public holiday calendar |
AirlinesController | /Airlines | Airline catalogue (for travel allowances) |
SocialInsuranceController | /SocialInsurance | Social insurance configuration |
EmploymentCommencementsController | /EmploymentCommencements | Onboarding / joining records |
SequenceController | /Sequence | Document sequence configuration |
HrConfigController | /HrConfig | HR module settings |
LookupController | /Lookup | Shared lookups and dropdowns |
Application Layer Structure
The Application project follows feature-folder CQRS organisation:
Microtec.Hr.Personnel.Application/
├── Employees/
│ ├── Commands/
│ │ ├── AddEmployee/
│ │ │ ├── AddEmployeeCommand.cs
│ │ │ ├── AddEmployeeCommandHandler.cs
│ │ │ ├── AddEmployeeCommandValidator.cs
│ │ │ └── Dto/AddEmployeeDto.cs
│ │ └── EditEmployee/
│ └── Queries/
│ ├── GetByIdEmployee/
│ ├── GetAllEmployees/
│ └── GetDropdownEmployee/
├── Departments/
├── Contracts/
├── PayrollRun/
└── ...Postman Collections
Postman collections for all HR endpoints are maintained in:
MicrotecHR/General files/Import these into Postman to test HR endpoints directly. Collections cover all 27 controllers with example request bodies and environment variables for dev/stage.
Exception Codes
The HR service uses the shared exception code system with HR-specific codes in the 9000-9030 range. See the HR API Reference for the full table.
Key HR exception categories:
| Range | Category |
|---|---|
| 9005–9008 | Entity relationship constraints (delete blocked) |
| 9009–9018 | Contract business rules |
| 9019–9021 | Salary template rules |
| 9022–9023 | Employee-specific rules |
| 9024–9027 | Record status and financial limits |
| 9028–9030 | Workflow and lifecycle rules |
Configuration
The HR service uses the same configuration pattern as other ERP microservices:
json
{
"ConnectionStrings": {
"DefaultConnection": "..."
},
"Keycloak": {
"Authority": "https://<keycloak-host>/realms/microtec",
"Audience": "account"
},
"Redis": {
"Configuration": "<redis-host>:10000,ssl=true,password=..."
}
}Environment-specific overrides use appsettings.stage.json, appsettings.prod.json, etc.
Local Development
Copy appsettings.Development.json to appsettings.user.json for local overrides. This file is gitignored.
Deployment
The HR service is containerised via the Dockerfile in Microtec.Hr.Personnel.Api/. It is included in the Azure DevOps pipeline service config at:
Devops/azure/config/container-backend/services-config.jsonunder the key hr.