# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Repository shape `HRM.UI` is the API/host project of a much larger multi-project HR/payroll system ("CEL.HRM.5"). It is **not a standalone git repo** — the `.git` directory lives one level up at `e:\HRMGIT\`, alongside sibling projects this project depends on via `ProjectReference`: - `HRM.BO` — business object / model classes (namespaces like `HRM.BO`, `HRM.BO.Basic`, `HRM.BO.Fund`, `Payroll.BO`) - `HRM.DA` — data access + business service implementations (namespaces like `HRM.DA.Service`, `HRM.DA.Service.Tax`, `HRM.DA.Service.Fund.*`) - `HRM.Report` — reporting project - `Ease.Core` — shared low-level framework (`Ease.Core.DataAccess`, referenced as `Ease.NetCore` NuGet package) Other siblings not referenced by this project directly: `Erecruitment.UI`, `HRM.AttendanceAutoProcess`, `HRM.MailNotificationProcess`, `IntegrationSuite`, `DatabaseComparison`. Because git operates from the parent directory, `git status`/`git log`/`git diff` run from within `HRM.UI` will reflect changes across **all** sibling projects, not just this one — be careful when staging/committing to only include files actually relevant to the task. There is also a nested, separately-buildable project at `Controllers\MobileAPI\HRMobileAPI.csproj` (legacy .NET Framework-style mobile API), included in `HRM.UI.sln`. ## Two apps in one repo - **Backend**: ASP.NET Core 10 Web API (`HRM.UI.csproj`, `Startup.cs`, `Program.cs`) — controllers only, business logic lives in `HRM.DA`/`HRM.BO`. - **Frontend**: Angular 19 SPA under `ClientApp/` (project name `babylon`), hosted via `Microsoft.AspNetCore.SpaServices.AngularCli` in dev (`spa.UseAngularCliServer(npmScript: "start")`). ## Common commands Backend (run from repo root, `e:\HRMGIT\HRM.UI`): ``` dotnet build HRM.UI.csproj dotnet run --project HRM.UI.csproj ``` The API listens on `https://localhost:44374` in dev (see `Properties/launchSettings.json`); this exact URL is also hardcoded as the Angular dev fallback base URL (`ClientApp/src/app/app.api.service.ts`). Frontend (run from `ClientApp/`): ``` npm start # ng serve, http://localhost:4200 npm run build # ng build -> dist/babylon npm test # ng test (Karma/Jasmine) npm run lint # ng lint ``` To run a single spec file, use Angular CLI's karma pass-through, e.g. `ng test --include='**/some.component.spec.ts'`. Normal full-stack dev loop is `dotnet run` from `HRM.UI` (it proxies to the Angular CLI dev server automatically in Development); running `ng serve` standalone in `ClientApp/` is useful for faster Angular-only iteration but API calls need the backend running separately on 44374. ## Backend architecture - **Controllers** (`Controllers/`) are organized by domain area (`Employee`, `Payroll`, `Leave`, `Attendance`, `Recruitment`, `Tax`, `Training`, `FundAdmin`, `Ess`, `Ess-Fund`, `GrievanceManagement`, `LearningManagement`, `Workflow`, `Claim`, `Final-Settlement`, `LongServiceAward`, `SearchTools`, `DataIntegration`, `Mobile`/`MobileAPI`, `Report`, etc.). Controllers are thin: they take many `IXxxService` interfaces via constructor injection and delegate to them — almost no business logic lives here. - All service interfaces/implementations (e.g. `IEmployeeService`, `ILeaveService`, `ITaxParameterService`, ~250+ of them) are registered in one place: `Configurations/DI/ServiceCollectionExtensions.cs` → `ConfigureBusinessServices(services)`, called from `Startup.ConfigureServices`. When adding a new service, register it there. Implementations live in the external `HRM.DA` project, not in this repo. - AutoMapper was removed in the .NET 10 upgrade (vulnerable, unused) — map by hand. - Auth: JWT bearer (`AddJwtBearer`), key from `AppSettings.Secret` via `Ease.Core.Utility.JwtSigningKey.FromSecret` (config section `AppSettings`), most controllers carry `[Authorize]`. - API versioning is configured (`Asp.Versioning`, `AddApiVersioning().AddMvc()`, URL-segment based) though most controllers use a single implicit v1. - CORS policy `"CORSPolicy"` currently restricts to `http://localhost:4200`. - RDLC report templates live under `RDLC/*.rdlc` and are rendered via `ReportViewerCore.NETCore`; report logic is in `HRM.Report`. - AI/OpenAI integration: `Microsoft.SemanticKernel` + `OpenAI` packages, `OpenAIService` singleton configured in `Startup.cs` from `OpenAI:ApiKey`/`OpenAI:Model` config, controller in `Controllers/OpenAIController`, Angular module `hrmopen-ai`. - Config comes from `appsettings.json` / `appsettings.Development.json` (`AppSettings`, `EmailSettings`, `EmployeeApiInfo`, `AdminPendingJob`, `MobileAppSettings`, `FundInfo`, `OpenAI` sections). ## Frontend architecture (`ClientApp/src/app`) - Feature areas are separate **lazy-loaded Angular modules**, registered in `app.routes.ts` under `AuthGuard`-protected paths (e.g. `payroll`, `leave`, `attendance`, `recruitment`, `core-hr`, `fund-admin`, `ess`, `ess-fund`, `ess-payroll`, `talent-management`, `final-settlement`, `training-new`, `claim`, `grievance-management`, `survey`, `organization-management`, `payment-approval`, `LMS`, `hrmopen-ai`, etc.). Each has its own `.module.ts` under `ClientApp/src/app//`. - Shared cross-cutting code lives in `_guards/`, `_models/`, `_services/`, `_picker/`, `picker/`, `dynamic-picker/`, `custom-components/`, `form-builder/`, `helper/`, `SharedIconModule/`. - `app.api.service.ts` (`ApiService`) is the single HTTP wrapper every feature module uses (`httpGet`, `httpPost`, `httpPostFile`, `httpDownloadFile`, etc.). It derives the API base URL from the page's `` in production, or falls back to `https://localhost:44374/api` in local dev. Auth token is a static `ApiService.AuthenticationToken`, sent as a Bearer header. - UI kit is a mix of PrimeNG (`primeng`, `@primeng/themes`, `primeflex`, `primeicons`) and Kendo UI Angular (`@progress/kendo-angular-*`, licensed via `kendo-ui-license.txt`/`telerik-license.txt`) plus Bootstrap 5. Charts use both `ng-apexcharts`/`apexcharts` and `chart.js`. Expect both PrimeNG and Kendo components/patterns depending on which module you're in — check the surrounding module for the convention already in use rather than assuming one library. - SSO/Azure AD is wired via `@azure/msal-angular` + `@azure/msal-browser` (`SSO.Config.ts`). ## Notes - `data/allowancedata.json`, `data/data.json` and files under `Documents/`, `EMPPHOTO/`, `LOGO/`, `RDLC/*.png` are runtime data/assets, not source to edit casually. - `ClientApp/dist` and `bin`/`obj` are build output — never hand-edit. - Large parts of `Startup.cs` (Swagger, AutoMapper config block, SPA static files) are commented out; check current behavior against the live code, not the comments, before assuming a feature (e.g. Swagger) is active.