feat(domain): RubroConProductosActivosException + guard en DeactivateRubro (closes #41) #44
Reference in New Issue
Block a user
Delete Branch "fix/issue-41-rubro-deactivation-guard"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
RubroConProductosActivosException(rubroId, productosActivosCount)en Domain → HTTP 409 con error coderubro_con_productos_activosIProductQueryRepositoryextendido conCountActiveByRubroAsync(rubroId, ct)— impl real DapperDeactivateRubroCommandHandlerinjectaIProductQueryRepositoryy ejecuta el guard después del check de hijos activos (orden: NotFound → ActiveChildren → ActiveProducts → deactivate)Test plan
RubroConProductosActivosExceptionTests(2 tests)DeactivateRubroCommandHandlerTestsextendido con 3 tests (throws con Products activos, OK con 0, order of checks — ActiveChildren antes que Products)ProductQueryRepository.CountActiveByRubroAsynccon 3 tests (active count correcto, inactive excluidos, otros rubros excluidos)/api/v1/admin/rubros/{id}con fake IProductQueryRepository viaCreateClientWithOverrides→ 409 + error codeGotcha resuelto
AlwaysInUseProductQueryRepositoryfake enProductTypesControllerTeststuvo que stubear el nuevo método de interfaz (return 0). Inserts de integration tests en Product usan nombres únicos por UQ filtered.Closes
Closes #41
Artifacts
sdd/prd-002-product-crud/archive-report)