Skip to content

Commit 373012b

Browse files
committed
docs: sync architecture and DDD context specifications with Ums.Domain C# codebase
1 parent 98da775 commit 373012b

7 files changed

Lines changed: 157 additions & 163 deletions

File tree

docs/architecture/blueprints/service-entity-map.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ This document serves as the authoritative mapping between system entities, their
2020
| **FUNCTIONAL_OPTION** | Authorization | UMS Core API | .NET 8 | `[ums_authz]` |
2121
| **ACTION** | Authorization | UMS Core API | .NET 8 | `[ums_authz]` |
2222
| **SYSTEM_SUITE** | Authorization | UMS Core API | .NET 8 | `[ums_authz]` |
23-
| **ROLE_PROMOTION_CRITERIA**| IGA | IGA Satellite | NestJS | `[ums_iga]` |
24-
| **USER_PROMOTION_PROCESS** | IGA | IGA Satellite | NestJS | `[ums_iga]` |
25-
| **USER_MANAGEMENT_DELEGATION**| IGA | IGA Satellite | NestJS | `[ums_iga]` |
26-
| **DOCUMENT_TYPE** | Compliance | Compliance Satellite | NestJS | `[ums_compliance]` |
27-
| **USER_DOCUMENT** | Compliance | Compliance Satellite | NestJS | `[ums_compliance]` |
28-
| **NOTIFICATION_RULE** | Compliance | Compliance Satellite | NestJS | `[ums_compliance]` |
29-
| **ACCESS_ENFORCEMENT_POLICY**| Compliance | Compliance Satellite | NestJS | `[ums_compliance]` |
30-
| **APPROVAL_WORKFLOW** | Approvals | UMS Core API | .NET 8 | `[ums_approval]` |
31-
| **APPROVAL_REQUIRED_DOCUMENT**| Approvals | UMS Core API | .NET 8 | `[ums_approval]` |
32-
| **APPROVAL_REQUEST** | Approvals | UMS Core API | .NET 8 | `[ums_approval]` |
33-
| **APPROVAL_LOG** | Approvals | UMS Core API | .NET 8 | `[ums_approval]` |
34-
| **APP_CONFIGURATION** | Configuration | UMS Core API | .NET 8 | `[ums_config]`
23+
| **ROLE_MATURITY_STATUS** | IGA | UMS Core API | .NET 8 | `[ums_iga]` |
24+
| **PROMOTION_REQUEST** | IGA | UMS Core API | .NET 8 | `[ums_iga]` |
25+
| **PROMOTION_IMPACT_ANALYSIS**| IGA | UMS Core API | .NET 8 | `[ums_iga]` |
26+
| **DOCUMENT_TYPE** | Compliance | UMS Core API | .NET 8 | `[ums_approval]` |
27+
| **USER_DOCUMENT** | Compliance | UMS Core API | .NET 8 | `[ums_approval]` |
28+
| **NOTIFICATION_RULE** | Compliance | UMS Core API | .NET 8 | `[ums_approval]` |
29+
| **ACCESS_ENFORCEMENT_POLICY**| Compliance | UMS Core API | .NET 8 | `[ums_approval]` |
30+
| **APPROVAL_WORKFLOW** | Approvals | UMS Core API | .NET 8 | `[ums_approval]` |
31+
| **APPROVAL_REQUIRED_DOCUMENT**| Approvals | UMS Core API | .NET 8 | `[ums_approval]` |
32+
| **APPROVAL_REQUEST** | Approvals | UMS Core API | .NET 8 | `[ums_approval]` |
33+
| **APPROVAL_LOG** | Approvals | UMS Core API | .NET 8 | `[ums_approval]` |
34+
| **APP_CONFIGURATION** | Configuration | UMS Core API | .NET 8 | `[ums_config]` |
3535
## 1.1 Mandatory Parametric Catalog Contract
3636

3737
For all parameter/configuration/catalog entities (including `APP_CONFIGURATION`, `NOTIFICATION_RULE`, `ACCESS_ENFORCEMENT_POLICY`, `APPROVAL_WORKFLOW`, and future `IDP_CONFIGURATION` / `SYSTEM_CONFIGURATION` / `FEATURE_FLAG` records), the write owner MUST enforce:

docs/governance/construction/ddd-design/03-identity-context.md

Lines changed: 49 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@
1111

1212
| Agregado | Raiz | Descripcion |
1313
|---------|------|-------------|
14-
| [Tenant](#aggregate-tenant) | `Tenant` | Nodo organizacional jerarquico |
15-
| [UserAccount](#aggregate-useraccount) | `UserAccount` | Principal autenticable |
16-
| [Branch](#aggregate-branch) | `Branch` | Sub-unidad fisica del tenant |
14+
| [Tenant](#aggregate-tenant) | `Tenant` | Nodo organizacional jerárquico y sus branches/proveedores de identidad |
15+
| [UserAccount](#aggregate-useraccount) | `UserAccount` | Principal autenticable con sus métodos de autenticación |
1716

1817
---
1918

@@ -25,62 +24,87 @@
2524

2625
| Entidad | Descripcion |
2726
|---------|-------------|
28-
| `Tenant` (AR) | Nodo organizacional en la jerarquia; equivale a Organization en el glosario |
27+
| `Tenant` (AR) | Nodo organizacional en la jerarquía; equivale a Organization en el glosario |
28+
| `Branch` | Sub-unidad física del tenant; ciclo de vida gobernado por el Tenant AR |
29+
| `IdentityProvider` | Proveedor de identidad federada registrado para el tenant |
30+
| `Branding` | Configuración visual y de DNS para el hosted login del tenant |
2931

3032
### Value Objects
3133

3234
| Value Object | Tipo base | Regla |
3335
|-------------|-----------|-------|
3436
| `TenantType` | enum | `ROOT / ENTERPRISE / SUBSIDIARY / DIVISION / BRANCH / DEPARTMENT` |
35-
| `TaxonomyRank` | int | Rango jerarquico; determina quien puede ser padre/hijo |
37+
| `TaxonomyRank` | int | Rango jerárquico; determina quién puede ser padre/hijo |
3638
| `TenantStatus` | enum | `ACTIVE / SUSPENDED / ARCHIVED` |
3739
| `OrganizationType` | enum | `INTERNAL / CLIENT / SUPPLIER / PARTNER` |
38-
| `CompanyReference` | string | Codigo ERP externo (SAP); inmutable post-creacion |
40+
| `CompanyReference` | string | Código ERP externo (SAP); inmutable post-creación |
3941
| `IdpStrategyHint` | enum | `INTERNAL_BCRYPT / ZITADEL / AZURE_AD / OKTA / SAML2 / GENERIC_OIDC` |
4042
| `TenantMetadata` | JSON | Payload libre validado como JSON |
43+
| `BranchCode` | string | Único dentro del tenant; slug alfanumérico |
44+
| `GeofencingMetadata` | JSON | Nullable; requiere `radius_km`, `center_lat`, `center_lng` si presente |
4145

4246
### Invariantes
4347

4448
| ID | Regla | Fuente |
4549
|----|-------|--------|
4650
| INV-T1 | `child.TaxonomyRank > parent.TaxonomyRank` — tipo hijo debe tener rango estrictamente mayor | ADR-0048 |
4751
| INV-T2 | `BRANCH` y `DEPARTMENT` no pueden tener hijos (`can_have_children = false`) | ADR-0048 |
48-
| INV-T3 | `ROOT` es su propio `root_tenant_id`; todos los demas deben diferir | ADR-0048 |
49-
| INV-T4 | `CompanyReference` debe ser unico dentro del tipo `CLIENT/SUPPLIER/PARTNER` del mismo parent | FS-03 |
50-
| INV-T5 | `ARCHIVED` es terminal; no retorna a `ACTIVE` sin proceso explicito | FS-03 |
52+
| INV-T3 | `ROOT` es su propio `root_tenant_id`; todos los demás deben diferir | ADR-0048 |
53+
| INV-T4 | `CompanyReference` debe ser único dentro del tipo `CLIENT/SUPPLIER/PARTNER` del mismo parent | FS-03 |
54+
| INV-T5 | `ARCHIVED` es terminal; no retorna a `ACTIVE` sin proceso explícito | FS-03 |
5155
| INV-T6 | No puede crearse `Branch` ni `UserAccount` bajo un Tenant `SUSPENDED` o `ARCHIVED` | FS-03 |
56+
| INV-B1 | `BranchCode` único dentro del `TenantId` | FS-03 |
57+
| INV-B2 | `GeofencingMetadata` válido JSON con claves requeridas si presente | conceptual-data-model.md |
58+
| INV-B3 | Branch inactiva o suspendida no puede recibir nuevos Profiles | FS-03 |
59+
| INV-B4 | Branch debe pertenecer a un Tenant `ACTIVE` | FS-03 |
5260

5361
### Comandos
5462

5563
| Comando | Descripcion |
5664
|---------|-------------|
5765
| `RegisterTenantCommand` | Registra un nuevo tenant con tipo, referencia externa y estrategia IdP |
5866
| `SuspendTenantCommand` | Suspende el tenant; bloquea acceso a todos sus usuarios |
59-
| `ArchiveTenantCommand` | Archiva el tenant; estado terminal |
60-
| `UpdateIdpStrategyCommand` | Cambia la estrategia de autenticacion del tenant |
61-
| `ConfigureBrandingCommand` | Configura branding del hosted login (FS-08) |
67+
| `ActivateTenantCommand` | Activa un tenant suspendido |
68+
| `AddBranchCommand` | Agrega una sub-unidad física (Branch) al tenant |
69+
| `RemoveBranchCommand` | Remueve una branch inactiva del tenant |
70+
| `DeactivateBranchCommand` | Suspende/desactiva temporalmente una branch activa |
71+
| `ReactivateBranchCommand` | Reactiva una branch suspendida |
72+
| `RegisterIdentityProviderCommand` | Registra un nuevo proveedor de identidad federada para el tenant |
73+
| `ActivateIdentityProviderCommand` | Activa un IdP y desactiva los demás del tenant |
74+
| `DeactivateIdentityProviderCommand` | Desactiva un IdP activo del tenant |
75+
| `RemoveIdentityProviderCommand` | Remueve un IdP registrado e inactivo del tenant |
76+
| `SetBrandingCommand` | Configura branding visual por primera vez |
77+
| `UpdateBrandingCommand` | Actualiza la configuración visual de branding existente |
78+
| `VerifyBrandingDnsCommand` | Marca el DNS de branding como verificado con éxito |
79+
| `FailBrandingDnsCommand` | Registra fallo en la verificación DNS del branding |
80+
| `RemoveBrandingCommand` | Remueve la configuración de branding del tenant |
6281

6382
### Eventos de Dominio
6483

6584
```
66-
TenantRegisteredEvent { tenantId, parentTenantId?, typeCode, companyReference? }
67-
TenantSuspendedEvent { tenantId, reason }
68-
TenantArchivedEvent { tenantId }
69-
TenantIdpStrategyUpdatedEvent { tenantId, newStrategy, version }
85+
TenantCreatedEvent { tenantId, code, name }
86+
TenantActivatedEvent { tenantId }
87+
TenantSuspendedEvent { tenantId }
88+
BranchCreatedEvent { tenantId, branchId, code }
89+
BranchRemovedEvent { tenantId, branchId }
90+
BranchDeactivatedEvent { tenantId, branchId }
91+
BranchReactivatedEvent { tenantId, branchId }
92+
IdentityProviderRegisteredEvent { tenantId, identityProviderId, code, strategyName }
93+
IdentityProviderActivatedEvent { tenantId, identityProviderId, code }
94+
IdentityProviderDeactivatedEvent { tenantId, identityProviderId, code }
95+
IdentityProviderRemovedEvent { tenantId, identityProviderId }
96+
BrandingCreatedEvent { tenantId, brandingId }
97+
BrandingUpdatedEvent { tenantId, brandingId }
98+
BrandingDnsVerifiedEvent { tenantId, brandingId }
99+
BrandingDnsFailedEvent { tenantId, brandingId }
100+
BrandingRemovedEvent { tenantId, brandingId }
70101
```
71102

72103
### Repositorio
73104

74105
```csharp
75-
ITenantRepository {
76-
FindByIdAsync(tenantId, rootTenantId)
77-
FindBySlugAsync(slug)
78-
FindDescendantsAsync(ancestorId, maxDepth?)
79-
FindAncestorsAsync(descendantId) // via TenantClosure
80-
IsDescendantOfAsync(candidateId, ancestorId) // 1 index lookup
81-
FindByCompanyReferenceAsync(reference, type)
82-
AddAsync(tenant)
83-
UpdateAsync(tenant)
106+
ITenantRepository : IAggregateRepository<Tenant> {
107+
GetByCodeAsync(code, cancellationToken)
84108
}
85109
```
86110

@@ -178,35 +202,4 @@ IUserAccountRepository {
178202

179203
---
180204

181-
## Aggregate: Branch
182-
183-
**Aggregate Root:** `Branch`
184-
**FS:** FS-03
185-
186-
### Value Objects
187-
188-
| Value Object | Tipo | Regla |
189-
|-------------|------|-------|
190-
| `BranchCode` | string | Unico dentro del tenant; slug alfanumerico |
191-
| `GeofencingMetadata` | JSON | Nullable; requiere `radius_km`, `center_lat`, `center_lng` si presente |
192-
| `BranchStatus` | enum | `ACTIVE / SUSPENDED` |
193-
194-
### Invariantes
195-
196-
| ID | Regla | Fuente |
197-
|----|-------|--------|
198-
| INV-B1 | `BranchCode` unico dentro del `TenantId` | FS-03 |
199-
| INV-B2 | `GeofencingMetadata` valido JSON con claves requeridas si presente | conceptual-data-model.md |
200-
| INV-B3 | Branch `SUSPENDED` no puede recibir nuevos Profiles | FS-03 |
201-
| INV-B4 | Branch debe pertenecer a un Tenant `ACTIVE` | FS-03 |
202-
203-
### Comandos y Eventos
204-
205-
```
206-
CreateBranchCommand -> BranchCreatedEvent { branchId, tenantId, code }
207-
SuspendBranchCommand -> BranchSuspendedEvent { branchId, tenantId }
208-
```
209-
210-
---
211-
212205
**[Anterior: Lenguaje Ubicuo](./02-ubiquitous-language.md)** | **[Indice DDD](./index.md)** | **[Siguiente: Authorization Context](./04-authorization-context.md)**

docs/governance/construction/ddd-design/04-authorization-context.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,16 @@
99

1010
## Agregados
1111

12-
| Agregado | Raiz | Descripcion |
13-
|---------|------|-------------|
14-
| [SystemSuite](#aggregate-systemsuite) | `SystemSuite` | Aplicacion cliente con topologia de recursos |
15-
| [Role](#aggregate-role) | `Role` | Rol jerarquico dentro de un sistema |
16-
| [PermissionTemplate](#aggregate-permissiontemplate) | `PermissionTemplate` | Blueprint de permisos reutilizable |
17-
| [TemplateAssignmentRule](#aggregate-templateassignmentrule) | `TemplateAssignmentRule` | Regla de auto-asignacion de templates |
18-
| [Profile](#aggregate-profile) | `Profile` | Coleccion de autorizaciones de un usuario |
12+
> [!NOTE]
13+
> En la implementación real de C# (base de código), **`Profile`** y **`PermissionTemplate`** son los únicos agregados locales de dominio activos. **`SystemSuite`**, **`Role`** y **`TemplateAssignmentRule`** están diferidos en esta fase y son consumidos mediante referencias desacopladas a nivel de Value Object ID (`SystemSuiteId`, `RoleId`).
14+
15+
| Agregado | Raiz | C# Status | Descripcion |
16+
|---------|------|-----------|-------------|
17+
| [Profile](#aggregate-profile) | `Profile` | **Activo** | Colección de autorizaciones de un usuario |
18+
| [PermissionTemplate](#aggregate-permissiontemplate) | `PermissionTemplate` | **Activo** | Blueprint de permisos reutilizable |
19+
| [SystemSuite](#aggregate-systemsuite) | `SystemSuite` | *Diferido (Ref ID)* | Aplicación cliente con topología de recursos |
20+
| [Role](#aggregate-role) | `Role` | *Diferido (Ref ID)* | Rol jerárquico dentro de un sistema |
21+
| [TemplateAssignmentRule](#aggregate-templateassignmentrule) | `TemplateAssignmentRule` | *Diferido (Ref ID)* | Regla de auto-asignación de templates |
1922

2023
---
2124

docs/governance/construction/ddd-design/07-approvals-context.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# BC-F — Approvals Context
22

33
**Schema:** `[ums_approval]` | **Owner:** UMS Core API .NET 8
4+
> [!NOTE]
5+
> En la implementación real de C# (base de código), los agregados de este contexto están consolidados junto con el contexto de Cumplimiento (Compliance) bajo el espacio de nombres unificado **[Ums.Domain.Approvals](file:///d:/Users/aarroyo/personal/sources/ums/src/apps/app-api-dotnet/Ums.Domain/Approvals/)**.
6+
47
**Mision:** Orquestar flujos de aprobacion para: acceso B2B externo, validacion de documentos y promocion de roles. Punto de control central para decisiones de autorizacion multi-paso.
58
**FS cubiertos:** FS-10, FS-12, FS-11 (validacion documental)
69
**Version:** 2.0 | **Fecha:** 2026-05-15

0 commit comments

Comments
 (0)