mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-28 22:42:11 +01:00
Extract domain-specific operations from CheckoutService into dedicated services to respect data-access layer boundaries and improve separation of concerns. ## Changes ### New Services Created **OrderCreationService** (oms-data-access) - createOrdersFromCheckout(): Creates orders from completed checkout - getLogistician(): Retrieves logistician (default '2470') - 8 unit tests with Jest/Spectator **AvailabilityService** (catalogue-data-access) - validateDownloadAvailabilities(): Validates download items availability - getDigDeliveryAvailability(): Gets DIG-Versand availability - getB2bDeliveryAvailability(): Gets B2B-Versand availability - 15 unit tests with Jest/Spectator **BranchService** (remission-data-access) - getDefaultBranch(): Gets default/current branch for user - 5 unit tests with Angular Testing Utilities - Note: Temporary location, will move to inventory-data-access ### CheckoutService Refactoring **Removed cross-domain imports:** - @generated/swagger/oms-api - @generated/swagger/availability-api - @generated/swagger/inventory-api **Added domain service dependencies:** - @isa/oms/data-access (OrderCreationService) - @isa/catalogue/data-access (AvailabilityService) - @isa/remission/data-access (BranchService) **Code reduction:** - Removed 254 lines (25.5% reduction: 996 → 742 lines) - Deleted 8 private methods moved to domain services ### Test Updates - Updated checkout.service.spec.ts with new service mocks - Fixed Zod validation (buyerType/payerType literals) - All 29 tests passing (8+15+5+11) ### AbortSignal Policy Removed abortSignal from data-mutating operations: - OrderCreationService.createOrdersFromCheckout() (POST) - Kept abortSignal for read-only operations per project convention ## Impact - Better separation of concerns - Improved maintainability (smaller, focused services) - Respects data-access layer boundaries - No functional changes (100% backward compatible) - 0 TypeScript compilation errors