|
| 1 | +# Governance Queries |
| 2 | + |
| 3 | +This example shows the query-oriented read side of `ModularityKit.Mutator.Governance`. |
| 4 | + |
| 5 | +It focuses on listing governed requests, approval work, and decision history without reconstructing those views manually from raw stored records. |
| 6 | + |
| 7 | +## What it demonstrates |
| 8 | + |
| 9 | +- querying governed requests with `MutationRequestQuery` |
| 10 | +- listing the pending approval queue through `IMutationRequestQueryStore` |
| 11 | +- listing pending requests by `PendingMutationReason` |
| 12 | +- querying requests by `StateId` and request category |
| 13 | +- listing recent approval-driven requests |
| 14 | +- projecting pending approval work with `MutationApprovalQuery` |
| 15 | +- projecting recent decision history with `MutationRequestDecisionQuery` |
| 16 | +- projecting recent execution outcomes separately from version resolution history |
| 17 | +- using the in-memory governance store as both write-side storage and query-side read model |
| 18 | + |
| 19 | +## Key files |
| 20 | + |
| 21 | +- [`Program.cs`](Program.cs) |
| 22 | +- [`Scenarios/GovernanceQueriesScenario.cs`](Scenarios/GovernanceQueriesScenario.cs) |
| 23 | +- [`Scenarios/GovernanceQueriesSampleData.cs`](Scenarios/GovernanceQueriesSampleData.cs) |
| 24 | +- [`Scenarios/RequestQueryScenario.cs`](Scenarios/RequestQueryScenario.cs) |
| 25 | +- [`Scenarios/ApprovalQueryScenario.cs`](Scenarios/ApprovalQueryScenario.cs) |
| 26 | +- [`Scenarios/DecisionQueryScenario.cs`](Scenarios/DecisionQueryScenario.cs) |
| 27 | +- [`src/Governance/Abstractions/Queries/Contracts/IMutationRequestQueryStore.cs`](../../../src/Governance/Abstractions/Queries/Contracts/IMutationRequestQueryStore.cs) |
| 28 | +- [`src/Governance/Abstractions/Queries/Model/MutationRequestQuery.cs`](../../../src/Governance/Abstractions/Queries/Model/MutationRequestQuery.cs) |
| 29 | +- [`src/Governance/Abstractions/Queries/Model/MutationApprovalQuery.cs`](../../../src/Governance/Abstractions/Queries/Model/MutationApprovalQuery.cs) |
| 30 | +- [`src/Governance/Abstractions/Queries/Model/MutationRequestDecisionQuery.cs`](../../../src/Governance/Abstractions/Queries/Model/MutationRequestDecisionQuery.cs) |
| 31 | + |
| 32 | +## Run |
| 33 | + |
| 34 | +```bash |
| 35 | +dotnet run --project Examples/Governance/Queries/Queries.csproj |
| 36 | +``` |
| 37 | + |
| 38 | +## Expected output |
| 39 | + |
| 40 | +The sample prints: |
| 41 | + |
| 42 | +- pending approval requests |
| 43 | +- pending external-check requests |
| 44 | +- requests filtered by request category |
| 45 | +- requests filtered by state |
| 46 | +- recent approval-driven requests |
| 47 | +- approval views filtered by approver |
| 48 | +- recent version-resolution decisions |
| 49 | +- recent execution outcomes |
0 commit comments