- Updated ESLint configuration to enforce stricter import rules for the @customer-portal/domain package, promoting better import hygiene and preventing deep imports. - Refactored various files across the BFF and portal applications to comply with the new import rules, ensuring that only the appropriate modules are imported from the domain. - Cleaned up unused imports and optimized code structure for improved maintainability and clarity. - Updated documentation to reflect changes in import practices and domain structure.
74 lines
2.4 KiB
TypeScript
74 lines
2.4 KiB
TypeScript
/**
|
|
* Customer Domain
|
|
*
|
|
* Main exports:
|
|
* - User: API response type
|
|
* - UserAuth: Portal DB auth state
|
|
* - Address: Address structure (follows billing/subscriptions pattern)
|
|
*
|
|
* Pattern matches billing and subscriptions domains.
|
|
*
|
|
* Types are derived from Zod schemas (Schema-First Approach)
|
|
*/
|
|
|
|
// ============================================================================
|
|
// Constants
|
|
// ============================================================================
|
|
|
|
export { USER_ROLE, type UserRoleValue } from "./contract.js";
|
|
|
|
// ============================================================================
|
|
// Domain Types (Clean Names - Public API)
|
|
// ============================================================================
|
|
|
|
export type {
|
|
User, // API response type (normalized camelCase)
|
|
UserAuth, // Portal DB auth state
|
|
UserRole, // "USER" | "ADMIN"
|
|
Address, // Address structure (not "CustomerAddress")
|
|
AddressFormData, // Address form validation
|
|
ProfileEditFormData, // Profile edit form data
|
|
ProfileDisplayData, // Profile display data (alias)
|
|
ResidenceCardVerificationStatus,
|
|
ResidenceCardVerification,
|
|
UserProfile, // Alias for User
|
|
AuthenticatedUser, // Alias for authenticated user
|
|
WhmcsClient, // Provider-normalized WHMCS client shape
|
|
} from "./schema.js";
|
|
|
|
// ============================================================================
|
|
// Schemas
|
|
// ============================================================================
|
|
|
|
export {
|
|
userSchema,
|
|
userAuthSchema,
|
|
addressSchema,
|
|
addressFormSchema,
|
|
profileEditFormSchema,
|
|
profileDisplayDataSchema,
|
|
residenceCardVerificationStatusSchema,
|
|
residenceCardVerificationSchema,
|
|
|
|
// Helper functions
|
|
combineToUser, // Domain helper: UserAuth + WhmcsClient → User
|
|
addressFormToRequest,
|
|
profileFormToRequest,
|
|
} from "./schema.js";
|
|
|
|
// ============================================================================
|
|
// Provider Namespace
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Providers namespace contains provider-specific implementations
|
|
*
|
|
* Access as:
|
|
* - Providers.Whmcs.Client (full WHMCS type)
|
|
* - Providers.Whmcs.transformWhmcsClientResponse()
|
|
* - Providers.Portal.mapPrismaUserToUserAuth()
|
|
*/
|
|
// NOTE: Provider adapters and provider-specific types are intentionally not exported
|
|
// from the module root. Import BFF-only provider APIs from:
|
|
// @customer-portal/domain/customer/providers
|