# `portal-platform` preset (business, stable)

> The selected business preset for LOMA-PORTAL. Models an enterprise portal: secure login, role-gated areas, document library, announcements, internal directory, and approval workflows.

## Domain entities (added on top of the stack baseline)

| Entity            | Notes                                                                                                                 |
| ----------------- | --------------------------------------------------------------------------------------------------------------------- |
| `Tenant`          | Optional even though `multiTenant=false` — kept as a single seeded tenant so the schema is ready for future scale-out |
| `Department`      | Org structure (parent/child)                                                                                          |
| `OrgUnit`         | Cross-cutting business unit                                                                                           |
| `Announcement`    | Pinned/timed messages, role-scoped                                                                                    |
| `Document`        | File metadata, version, tags, ACL — uses `enterprise-modules/file-storage`                                            |
| `ApprovalRequest` | State machine: draft → submitted → reviewed → approved/rejected                                                       |
| `ApprovalStep`    | Polymorphic approver (user / role / department head)                                                                  |
| `DirectoryEntry`  | People search index (denormalized from User + Department)                                                             |

## Feature surface (UI + API)

| Feature              | Frontend route                 | API surface                              |
| -------------------- | ------------------------------ | ---------------------------------------- |
| Login + refresh      | `/auth/login`                  | `POST /api/auth/login`, `/refresh`       |
| Dashboard            | `/dashboard`                   | `GET /api/dashboard/summary`             |
| Document library     | `/documents`                   | `GET/POST/DELETE /api/documents`         |
| Announcements        | `/announcements`               | `GET/POST /api/announcements`            |
| Approval inbox       | `/approvals`                   | `GET /api/approvals?status=...`          |
| Approval submission  | `/approvals/new`               | `POST /api/approvals`                    |
| Internal directory   | `/directory`                   | `GET /api/directory?q=...`               |
| Admin: users + roles | `/admin/users`, `/admin/roles` | `GET/POST /api/admin/users`, `.../roles` |
| Audit log viewer     | `/admin/audit`                 | `GET /api/admin/audit?since=...`         |

## Requires

This preset is meant to land on top of:

- `angular-enterprise` (frontend)
- `dotnet-enterprise` (backend)
- A theme preset (default: `premium-theme`)

It does **not** hard-require any of them — the surface degrades gracefully (e.g. only API materializes if no frontend preset is selected).

## Knowledge seeds

Materialized into `knowledge/`:

- `knowledge/business/portal-tenancy-model.md`
- `knowledge/workflows/approval-chain.md`
- `knowledge/workflows/onboarding-kyc.md`
- `knowledge/patterns/document-library.md`

These let the AI agent reason about portal-specific decisions without re-deriving the domain.

## Conflicts

| With                 | Why                                                                                   |
| -------------------- | ------------------------------------------------------------------------------------- |
| `ecommerce-platform` | Cart/Order/Product entities collide with portal Document/Announcement focus; pick one |

## Phase mapping

- Phase 2 (this phase): preset manifest + README + knowledge seed placeholders
- Phase 3: portal-specific routes/components in `apps/web-angular/features/`
- Phase 4: portal-specific controllers in `dotnet/src/Api/Controllers/Portal/`
- Phase 5: portal entities in `prisma/schema.prisma` + EF configurations
- Phase 7: knowledge seeds populated for the AI agent
