# OpsController

**Kind:** Controller

**Source:** [`atloria-monorepo/apps/api/src/ops/ops.controller.ts`](https://github.com/sherkety/atloria/blob/main/atloria-monorepo/apps/api/src/ops/ops.controller.ts#L8)

Admin cockpit (Phase 2.3) — org-scoped operational overview.

`OpsController` provides the admin cockpit API for organization-scoped operational visibility. It coordinates authenticated admin requests with the operations layer to return overview data needed for monitoring and managing an organization.

## Diagram

```mermaid
graph LR
  Admin[Admin User / Ops UI] -->|Authenticated request| Controller[OpsController]
  Controller -->|Resolve organization scope| Auth[Auth / Organization Context]
  Controller -->|Request operational overview| OpsService[Operations Service]
  OpsService --> Data[Operational Data Sources]
  Data --> OpsService
  OpsService --> Controller
  Controller -->|Organization-scoped response| Admin
```

## Usage

```ts
// Example client request from an admin dashboard.
// The authenticated session/token must include access to the target organization.

const response = await fetch(
  `${process.env.API_URL}/ops/overview`,
  {
    method: 'GET',
    headers: {
      Authorization: `Bearer ${adminAccessToken}`,
      'Content-Type': 'application/json',
    },
  },
);

if (!response.ok) {
  throw new Error(`Unable to load operations overview: ${response.status}`);
}

const overview = await response.json();

console.log('Operational overview:', overview);
```

## AI Coding Instructions

- Preserve organization scoping for every endpoint; never return cross-organization operational data.
- Follow existing NestJS controller conventions for guards, decorators, DTOs, and response handling.
- Keep business logic out of `OpsController`; delegate aggregation and data access to the appropriate service layer.
- Ensure new operational endpoints enforce admin-level authorization consistent with the rest of the API.
- Treat overview payloads as dashboard contracts: add fields compatibly and document any breaking response changes.

## Relationships

- MODULE_DECLARES → `overview`
- DEPENDS_ON → `OpsService`

## Referenced By

- `OpsModule` (MODULE_DECLARES)
