# Pams

## What it is responsible for

Pams manages authenticated application work across server-side entry points and Angular-facing members, turning requests into controller actions and UI/service interactions. Work enters through `AuthenticatedController` and `BaseController`, while account-manager target operations are represented by `AccountManagerTargetController`, `GetAccountManagersTargetByYear`, and `SaveAccountManagerTarget`. Named members also include `MrqService`, `BillOfMaterialsService`, and `AppRoutingModule`; the authors identify an Angular CLI-generated project and document development, build, test, and end-to-end commands. `MrqDetailsComponent`, `MrqInquiryComponent`, and `MrqListComponent` are named components alongside bill-of-materials and blog details and list members.

## What it refuses

Pams rejects `UnauthorizedAccessException` when `!HasAnyRole(roles)` and when `!HasAllRoles(roles)`. It rejects Two-factor authentication required when `!HasCompletedTwoFactor`; Access denied to company resources when `!ValidateCompanyAccess(companyId)`; and Access denied to branch resources when `!ValidateBranchAccess(branchId)`. It rejects `HttpResponseException` when `!Request.Content.IsMimeMultipartContent()` and when `!isFound` or `userId != CurrentPersonUserID`. The stated conditions are refusals, not optional outcomes.

## What it needs, and who needs it

Pams has no listed dependencies in this repository. The named consumers `Frontend`, `Outlook_plugin/src/account`, `Activity`, `Attachement`, `Auth`, `Calendar`, `Contacts`, `Pams Web`, and `Outlook_plugin/src/taskpane` depend on it. Without Pams, these consumers lose the subsystem they name as a dependency, including its authenticated entry points, target operations, and named application members. The evidence names no repository-side prerequisite that Pams itself requires.

## Notable members

`AuthenticatedController` is a listed work entry point. `AccountManagerTargetController` carries the identified account-manager target work: `GetAccountManagersTargetByYear` names retrieval by year, and `SaveAccountManagerTarget` names saving. `AppRoutingModule` is the named routing member. `MrqService` and `BillOfMaterialsService` are named service members; the supplied evidence does not state their operations or contracts.

7051 entities in `Pams`. **9 other subsystems depend on it**, which makes it the most depended-upon part of this codebase.

## What it is made of

Its 7051 entities sit in 2345 files under `Pams`: 3625 classes, 1781 HTTP endpoints, 524 services, 374 components and 747 more.
`PamsLinq5.designer.cs` holds 691 of them — more than any other file here.
`Newtonsoft.Json` is what the rest of it leans on: 9 of its own members depend on it, more than on anything else inside the boundary.
`NewProject` declares 50 methods, the widest surface here.

## Where work enters

248 controllers publish 1781 HTTP endpoints — 877 `GET`, 565 `POST`, 329 `PUT` and 10 `DELETE`. `DashboardPiplineController` carries 48 of them; the remaining 1733 are split across 210 other controllers. None of them declares a guard.

- [`AuthenticatedController`](controller-authenticatedcontroller) — `Pams/API/Pams.API/ActionFilters/JWTAuthenticateAttribute.cs`:524
- [`BaseController`](controller-basecontroller) — `Pams/API/Pams.API/Controllers/BaseController.cs`:515
- [`AccountManagerTargetController`](controller-accountmanagertargetcontroller) — `Pams/API/Pams.API/Controllers/BookingTarget/AccountManagerTargetController.cs`:11
- [`GetById`](api-endpoint-getbyid-71) — `Pams/API/Pams.API/Controllers/BookingTarget/AccountManagerTargetController.cs`:22
- [`GetAccountManagersTargetByYear`](api-endpoint-getaccountmanagerstargetbyyear) — `Pams/API/Pams.API/Controllers/BookingTarget/AccountManagerTargetController.cs`:33
- [`SaveAccountManagerTarget`](api-endpoint-saveaccountmanagertarget) — `Pams/API/Pams.API/Controllers/BookingTarget/AccountManagerTargetController.cs`:44

## How it refuses and fails

295 of its components record a refusal or a failure handler.
280 of them refuse work outright, under a condition written into the component itself.
Their `catch` blocks handle a failure that already happened in 577 places.
Of those 577, 558 turn it into a return value, 8 log it and continue, 7 discard it without recording anything and 4 let it reach the caller.
`FilesController` holds 2 of the silent ones — a failure discarded silently leaves no trace for whoever debugs this later.

## Boundaries

**9 other subsystems depend on this one** — `Frontend`, `Account`, `Activity`, `Attachement`, `Auth`, `Calendar`, `Contacts`, `Pams Web`, `Taskpane`. Changing what it exposes changes them.

Those 9 hold 255 edges between them, unevenly: `Frontend` reaches in across 236 edges, while 3 of them hold one each. What they reach is narrower than the folder: 187 of its 7051 members carry every inbound edge — `AccountsController` (16), `ActivitiesController` (7) and `PersonController` (6), plus 184 more.

**It depends on no other subsystem in this repository** — it is a leaf.

## How this code is named

These conventions cover most of the codebase. Learning them is faster than reading an index —
each one lets you find any member of its family without looking it up.

| Pattern | Where | Count | Examples |
|---|---|---|---|
| `*.component.ts` | across the repository | 396 | `app.component.ts`, `new.component.ts`, `tag.component.ts`, `home.component.ts` |
| `*.model.ts` | across the repository | 293 | `job.model.ts`, `city.model.ts`, `tags.model.ts`, `unit.model.ts` |
| `*.service.ts` | across the repository | 282 | `mrq.service.ts`, `mrm.service.ts`, `app.service.ts`, `task.service.ts` |
| `*.model.cs` | across the repository | 135 | `City.Model.cs`, `Tags.Model.cs`, `Role.Model.cs`, `Task.Model.cs` |
