# PMS Master Domain WBS (Domain-First)

**Status:** Refactored planning document (no implementation)  
**Source WBS (preserved):** [docs/projects/PMS_PHASE1_TASK_CARDS.md](../../projects/PMS_PHASE1_TASK_CARDS.md)  
**Business SRS:** [Project Management System — Business SRS.md](../../projects/Project%20Management%20System%20%E2%80%94%20Business%20SRS.md)  
**Commissioning SRS (boundary only):** [Commissioning Management System — SRS & Dynamic Rule Matrix.md](../../projects/Commissioning%20Management%20System%20%E2%80%94%20SRS%20%26%20Dynamic%20Rule%20Matrix.md)  
**Architecture:** ERPFlow Service Repository (`.cursor/skills/coding-standard/SKILL.md`)

---

## Purpose of this refactor

Reorganize the existing Phase 1 task cards into:

```text
PMS → Domain → Feature → Workstream → Task → Sub-task
```

Developer/lane ownership remains **metadata**, not the primary hierarchy.

Canonical detailed acceptance criteria remain in `PMS_PHASE1_TASK_CARDS.md`.  
**সব table-এর column এক জায়গায়:** [phase1-database-schema.md](./phase1-database-schema.md) (`PMS-SCHEMA-1`)।  
This tree is the **execution-oriented domain index** + structural overlays (API contracts, waves, deps).

---

## Non-negotiable business distinctions (SRS)

| Concept | Meaning |
| --- | --- |
| Permanent Team Membership | Employee’s home/service team (`service_team_members`) |
| Contract Membership | Selected people on a contract (`contract_members`) |
| Contract Role | Role **on that contract** via `designation_id` |
| Act-As | Contract-specific; does **not** change permanent membership |
| PM | **Member of Project** (delivery contributor) — not Project Manager |
| Commission Rule ≠ Earning Record | Shell only in Phase 1 |

---

## Phase / Commissioning boundary (unchanged)

### Phase 1 — PMS owns

Client (reuse) · Project · Type · Category (exists) · Service · Contract · Team · Assignment · Act-As · Commission Share inputs · Commission **Rule shell** · Earning **Record shell** · Payment-cleared **hook** · Reports

### Phase 1 — MUST NOT implement

Full commission calculation · payment-cleared auto distribution · Fixed Team Allocation engine · PF maturity · EPS · commission approval/payment workflow

### Commissioning module owns (later)

Rules engine, eligibility, calculation, duration, redistribution, salary/fund allocation, vesting, settlement, commission ledger  
→ tracked as `PMS-COMM-EPIC` (Phase 2); see Commissioning SRS  
→ **Build plan:** [COMMISSIONING_IMPLEMENTATION_PLAN.md](../commission/COMMISSIONING_IMPLEMENTATION_PLAN.md) (stub-first, connect Project later)

### Already delivered (do not recreate)

| Item | Notes |
| --- | --- |
| `project_categories` | Exists — Project Category feature mostly **Already delivered** |
| `office_expense_rules` | Exists — Commissioning/Phase 2 consumer |
| `provident_fund_role_rules` | Exists — Phase 2 |
| `ProjectController` | Stub only — real API is `PMS-2.1-BE` |

---

## Lane ownership metadata (unchanged)

| Lane | Owner | Primary domains |
| --- | --- | --- |
| A | Ashraful | Project, Contract, Commission Share, Earning shell, core spine |
| B | Munna | Service Teams, Membership, Contract Assignment, Act-As, assignment reports |
| C | Sharif | Masters/config, commission rule shell, seeders, some reports |
| D | Bablu | All PMS UI, nav, permissions seed |
| Shared | Ashraful leads | ERD lock, **full DB schema lock (PMS-SCHEMA-1)**, E2E QA |

**Table rule:** one physical table → one primary lane owner.

---

## Master hierarchy

```text
PMS
│
├── 01. Foundation
│   ├── কোন table আছে + কে owner                   PMS-0.1 (Ashraful)
│   ├── সব table-এর column এক doc-এ                PMS-SCHEMA-1 (Ashraful + review)
│   └── API Envelope / Conventions Lock            PMS-API-0 (Ashraful)
│
├── 02. Project Management
│   ├── Project Type                               PMS-API-1.1 · PMS-1.1-BE · PMS-1.1-FE
│   ├── Project Category                           PMS-1.0-BE · PMS-1.0-FE (verify existing)
│   ├── Project                                    PMS-API-2.1 · PMS-2.1-BE · PMS-2.1-FE
│   ├── Project ↔ Service                          PMS-API-2.2 · PMS-2.2-BE · PMS-2.2-FE
│   └── Project Status                             (on Project) + Contract status PMS-2.4-BE/FE
│
├── 03. Service Management
│   ├── Service Master                             PMS-API-1.2 · PMS-1.2-BE · PMS-1.2-FE
│   └── Client Integration                         PMS-1.5-BE
│
├── 04. Team Management
│   ├── Team Divisions & Roles                     PMS-API-1.3 · PMS-1.3-BE · PMS-1.3-FE
│   ├── Service Team                               PMS-API-3.1 · PMS-3.1-BE
│   ├── Permanent Team Membership                  PMS-3.2-BE
│   └── Team UI                                    PMS-3.1-FE
│
├── 05. Contract Management
│   ├── Contract                                   PMS-API-2.3 · PMS-2.3-BE · PMS-2.3-FE
│   ├── Contract Status Transitions                PMS-2.4-BE · PMS-2.4-FE
│   └── Contract Attachments                       PMS-2.6-BE · PMS-2.6-FE
│
├── 06. Contract Role & Act-As
│   ├── Contract Member + Act-As                   PMS-API-3.3 · PMS-3.3-BE · PMS-3.3-FE
│   ├── Assignment Validation                      PMS-3.4-BE
│   └── Assignment History                         PMS-3.5-BE
│
├── 07. Commission Share
│   ├── Team / BD / PD Share                       PMS-API-2.5 · PMS-2.5-BE · PMS-2.5-FE
│   └── Share Summary Report                       PMS-5.6-BE · PMS-5.6-FE
│
├── 08. Commission Integration (shell only)
│   ├── Commission Types                           PMS-1.4a-BE · PMS-1.4a-FE
│   ├── Commission Rule Shell                      PMS-API-1.4 · PMS-1.4-BE · PMS-1.4-FE
│   ├── Earning Record Shell                       PMS-5.1-BE · PMS-5.1-FE
│   ├── Payment Cleared Hook                       PMS-5.2-BE
│   └── Full Commission Engine                     PMS-COMM-EPIC (Phase 2)
│
├── 09. Reports
│   ├── Employee Assignment                        PMS-5.3-BE · PMS-5.3-FE
│   ├── Contract/Service Team                      PMS-5.4-BE · PMS-5.4-FE
│   ├── Project-wise Team                          PMS-5.7-BE · PMS-5.7-FE
│   ├── Active/Expired Contracts                   PMS-5.5-BE · PMS-5.5-FE
│   ├── Commission Share Summary                   PMS-5.6-BE · PMS-5.6-FE
│   └── BD/PD Commission Earnings (shell read)     PMS-5.8-BE · PMS-5.8-FE
│
├── 10. Permissions & RBAC                         PMS-0.2
├── 11. API & Integration                          PMS-API-* + PMS-1.5-BE
├── 12. Frontend                                   PMS-0.1-FE + all *-FE
├── 13. Testing & QA                               per-card DoD + PMS-QA-1
└── 14. Deployment & Documentation                 PMS-4.1-BE · PMS-DOC-1
```

**SRS §31 coverage:** every Initial Scope bullet maps to at least one Phase-1 task above.  
**Commission Calculation** in SRS = Phase-1 **Earning shell + reports on stored rows**; full engine = `PMS-COMM-EPIC`.

Paste-ready cards: [PMS_PHASE1_TASK_CARDS.md](../../projects/PMS_PHASE1_TASK_CARDS.md) (65 assignable rows in Index).  
API Contract meaning: [what-is-api-contract.md](./what-is-api-contract.md).

## Document map

| File | Content |
| --- | --- |
| [01-foundation.md](./01-foundation.md) | Foundation + API envelope |
| [02-project.md](./02-project.md) | Project domain |
| [03-service.md](./03-service.md) | Service domain |
| [04-team.md](./04-team.md) | Team domain |
| [05-contract.md](./05-contract.md) | Contract domain |
| [06-contract-role-act-as.md](./06-contract-role-act-as.md) | Roles / Act-As |
| [07-commission-share.md](./07-commission-share.md) | Team/BD/PD share |
| [08-commission-integration.md](./08-commission-integration.md) | Shell + Phase 2 epic |
| [09-reports.md](./09-reports.md) | Reports |
| [10-permissions.md](./10-permissions.md) | RBAC |
| [11-api.md](./11-api.md) | API contract locks |
| [12-frontend.md](./12-frontend.md) | Frontend aggregation |
| [13-testing.md](./13-testing.md) | Testing & QA |
| [what-is-api-contract.md](./what-is-api-contract.md) | API Contract explained |
| [developer-lane-view.md](./developer-lane-view.md) | Derived lane view |
| [dependency-matrix.md](./dependency-matrix.md) | HARD/SOFT/INFO deps |
| [parallel-execution-plan.md](./parallel-execution-plan.md) | Waves, critical path, utilization |
| [wbs-migration-map.md](./wbs-migration-map.md) | Old → new mapping |

---

## Global Definition of Done

### Backend (ERPFlow)

Service + interface · Repository + interface · Form Request · API Resource · `company_id` tenant scope · permission middleware · controller try/catch · feature tests (happy + validation + IDOR) · **no** Generic BaseRepository / unnecessary abstractions

### Frontend

List/loading/empty/error · form validation · API error mapping · permission gating · existing ERP UI patterns

### API Contract task DoD

Endpoint list · methods · request/response shapes · error contract · permissions · status codes · pagination/filter · example payloads · published before dependent FE treats BE as HARD-blocked

---

## How to use with task manager

1. Domain file = where the work lives  
2. `PMS_PHASE1_TASK_CARDS.md` = paste-ready card body (schema, AC detail)  
3. Lane view = who works what this week  
4. Dependency matrix + waves = what can start now
