- Add UpdateCurrentCompanyUseCase to handle company updates. - Create update-current-company.controller.ts to manage update requests. - Implement validation and mapping for update requests using Zod. - Add tests for the update use case and controller to ensure functionality. - Introduce error handling and feedback state management for company details settings. - Create utility functions for error normalization and feedback state resolution. - Implement tests for error handling and feedback state utilities. - Ensure nullable fields are handled correctly in DTOs and forms.
94 lines
2.5 KiB
Markdown
94 lines
2.5 KiB
Markdown
# Identity Migration Status
|
|
|
|
## Referencias canónicas
|
|
|
|
- Reglas de contexto tenant y middlewares públicos: [tenant-context.md](./tenant-context.md)
|
|
- Flujo frontend de autenticación y selección de empresa: [../frontend/auth-and-company-selection.md](../frontend/auth-and-company-selection.md)
|
|
- Runtime y responsabilidades del módulo `identity`: [../../modules/identity/README.md](../../modules/identity/README.md)
|
|
|
|
## Migrado a `identity`
|
|
|
|
### Backend tenant-scoped
|
|
|
|
Módulos migrados:
|
|
|
|
- `modules/catalogs`
|
|
- `modules/customers`
|
|
- `modules/customer-invoices`
|
|
- `modules/factuges`
|
|
|
|
Estado:
|
|
|
|
- sin `@erp/auth/api`
|
|
- sin `mockUser`
|
|
- sin helpers locales de auth
|
|
- usan el middleware tenant canónico documentado en `tenant-context.md`
|
|
|
|
### Backend autenticado sin tenant
|
|
|
|
`modules/companies` usa el middleware autenticado sin tenant documentado en `tenant-context.md`.
|
|
|
|
Esto aplica a:
|
|
|
|
```http
|
|
POST /companies
|
|
GET /companies/available
|
|
GET /companies/:company_id
|
|
PATCH /companies/:company_id
|
|
POST /companies/:company_id/enable
|
|
POST /companies/:company_id/disable
|
|
```
|
|
|
|
### Backend tenant-scoped en `modules/companies`
|
|
|
|
`modules/companies` también expone endpoints tenant-scoped para operar sobre la company activa o endurecer endpoints legacy.
|
|
|
|
Esto aplica a:
|
|
|
|
```http
|
|
GET /companies/current
|
|
PATCH /companies/current
|
|
GET /companies/:company_id
|
|
PATCH /companies/:company_id
|
|
POST /companies/:company_id/enable
|
|
POST /companies/:company_id/disable
|
|
```
|
|
|
|
Política V1 actual para `PATCH /companies/current`:
|
|
|
|
```txt
|
|
usuario autenticado
|
|
+ X-Company-Id válido
|
|
+ membership activa
|
|
+ company activa
|
|
```
|
|
|
|
No existe todavía enforcement real de `identity:companies:update`.
|
|
|
|
## Frontend actual
|
|
|
|
El runtime nuevo ya usa `@erp/identity/client`.
|
|
|
|
Los detalles del flujo implementado, headers y refresh automático se mantienen en `frontend/auth-and-company-selection.md`.
|
|
|
|
## Legacy pendiente
|
|
|
|
`modules/auth` queda legacy/deprecated y no debe usarse en backend nuevo.
|
|
|
|
Sigue pendiente revisar o retirar consumidores legacy residuales antes de eliminarlo por completo.
|
|
|
|
### `modules/supplier`
|
|
|
|
Queda fuera de esta migración por ahora.
|
|
|
|
## Búsquedas útiles de control
|
|
|
|
```powershell
|
|
rg -n -F "@erp/auth/api" modules apps packages
|
|
rg -n -F "mockUser" modules apps packages
|
|
rg -n -F "IdentityInternalDeps" modules apps packages
|
|
rg -n -F 'getInternal(\"identity\")' modules apps packages
|
|
rg -n -F "requireIdentityTenant(params)" modules apps packages
|
|
rg -n -F "requireIdentityAuthenticated(params)" modules apps packages
|
|
```
|