Comprehensive refactoring across 70 files (net -298 lines) improving
type safety, error handling, and code organization:
- Replace .passthrough()/.catchall(z.unknown()) with .strip() in all Zod schemas
- Tighten Record<string, unknown> to bounded union types where possible
- Replace throw new Error with domain-specific exceptions (OrderException,
FulfillmentException, WhmcsOperationException, SalesforceOperationException, etc.)
- Split AuthTokenService (625 lines) into TokenGeneratorService and
TokenRefreshService with thin orchestrator
- Deduplicate FreebitClientService with shared makeRequest() method
- Add typed interfaces to WHMCS facade, order service, and fulfillment mapper
- Externalize hardcoded config values to ConfigService with env fallbacks
- Consolidate duplicate billing cycle enums into shared billingCycleSchema
- Standardize logger usage (nestjs-pino @Inject(Logger) everywhere)
- Move shared WHMCS number coercion helpers to whmcs-utils/schema.ts
- Removed the TransformInterceptor to streamline response handling, ensuring that all responses are returned directly without a success envelope.
- Updated various controllers and services to utilize new action response schemas, enhancing clarity and consistency in API responses.
- Refactored error handling in the CsrfController and CheckoutController to improve logging and error management.
- Cleaned up unused imports and optimized code structure for better maintainability and clarity across the application.
- Updated InvoicesController, NotificationsController, OrdersController, and SubscriptionsController to replace inline parameter validation with Zod DTOs, enhancing code maintainability and clarity.
- Introduced new DTOs for invoice and notification ID parameters, ensuring consistent validation across endpoints.
- Refactored service method calls to utilize the new DTOs, improving type safety and reducing potential errors.
- Cleaned up unused imports and optimized code structure for better readability.
- Introduced Zod DTOs for request validation across multiple controllers, replacing inline validation with structured classes for improved maintainability and clarity.
- Updated ESLint configuration to enforce a rule against importing Zod directly in BFF controllers, promoting the use of shared domain schemas for request validation.
- Removed the SecureErrorMapperService to streamline the security module, as its functionality was deemed unnecessary.
- Enhanced various controllers to utilize the new DTOs, ensuring consistent validation and response handling across the application.
- Refactored the SignupWorkflowService to throw a DomainHttpException for legacy account conflicts, improving error handling.
- Updated the SignupForm component to include initialEmail and showFooterLinks props, enhancing user experience during account creation.
- Improved the AccountStep in the SignupForm to allow users to add optional details, such as date of birth and gender, for a more personalized signup process.
- Enhanced the PasswordStep to include terms acceptance and marketing consent options, ensuring compliance and user engagement.
- Updated various catalog views to improve layout and user guidance, streamlining the onboarding process for new users.
- Changed TypeScript target and library settings in tsconfig files to align with ESNext standards.
- Updated pnpm version in GitHub workflows for better dependency management.
- Modified Dockerfile to reflect the updated pnpm version.
- Adjusted import statements across various domain modules to include file extensions for consistency and compatibility.
- Cleaned up TypeScript configuration files for improved clarity and organization.
- Introduced new endpoints in SubscriptionsController for retrieving SIM top-up pricing and previewing pricing based on quota.
- Integrated SimTopUpPricingService into the subscriptions module to handle pricing logic.
- Updated TopUpModal component to utilize the new pricing service for dynamic cost calculations and validation.
- Enhanced error handling and user feedback in the TopUpModal for improved user experience during data top-up operations.
- Refactored order display utilities to support new pricing structures and ensure consistent presentation across the application.
- Introduced OrderEventsService to manage order-related events and updates.
- Added SSE endpoint in OrdersController for streaming order updates to clients.
- Enhanced OrderFulfillmentOrchestrator to publish order status updates during fulfillment processes.
- Updated order field mappings to include bundled add-on information for improved order detail handling.
- Refactored OrderCard and OrderDetail components for better display of order information and status updates.
- Implemented Redis-backed idempotency keys in SIM activation to prevent race conditions and double-charging.
- Increased bcrypt hashing rounds from 12 to 14 for stronger password security.
- Introduced a structured exception hierarchy to replace generic errors with domain-specific exceptions.
- Centralized Internet Access Mode constants and improved schema organization by extracting duplicated enum values.
- Updated various components to utilize new domain types for better consistency and maintainability.
- Enhanced error handling in SIM fulfillment and order activation processes to provide clearer feedback and prevent duplicate processing.
- Refreshed CODEBASE_ANALYSIS.md to reflect the new ownership model and improve onboarding documentation.
- Deleted obsolete VALIDATION_DUPLICATION_REPORT.md to streamline the codebase.
- Made minor adjustments to various components and services for better organization and clarity.
- Imported salesforceIdSchema and nonEmptyStringSchema from the common domain for better consistency.
- Simplified the creation of SOQL field name validation schema.
- Refactored the InvoiceTable component to utilize useCallback for improved performance.
- Streamlined payment method handling in the PaymentMethodCard component by removing unused props.
- Enhanced the checkout process by integrating new validation schemas and improving cart handling logic.
- Updated various components to ensure better type safety and clarity in data handling.