barsa 1dc8fbf36d Refactor user management and validation integration
- Replaced UsersService with UsersFacade across various modules for improved abstraction and consistency.
- Updated validation imports to utilize the new @customer-portal/validation package, enhancing modularity.
- Removed deprecated validation files and streamlined user-related logic in controllers and services.
- Enhanced order processing by integrating field mappings for Salesforce orders, improving maintainability.
- Improved error handling and response structures in authentication and user management workflows.
2025-11-04 13:28:36 +09:00

81 lines
2.3 KiB
TypeScript

/**
* Auth Domain - Contract
*
* Constants and types for the authentication domain.
* All validated types are derived from schemas (see schema.ts).
*/
// ============================================================================
// Authentication Error Codes
// ============================================================================
export const AUTH_ERROR_CODE = {
INVALID_CREDENTIALS: "INVALID_CREDENTIALS",
EMAIL_NOT_VERIFIED: "EMAIL_NOT_VERIFIED",
ACCOUNT_LOCKED: "ACCOUNT_LOCKED",
MFA_REQUIRED: "MFA_REQUIRED",
INVALID_TOKEN: "INVALID_TOKEN",
TOKEN_EXPIRED: "TOKEN_EXPIRED",
PASSWORD_TOO_WEAK: "PASSWORD_TOO_WEAK",
EMAIL_ALREADY_EXISTS: "EMAIL_ALREADY_EXISTS",
WHMCS_ACCOUNT_NOT_FOUND: "WHMCS_ACCOUNT_NOT_FOUND",
SALESFORCE_ACCOUNT_NOT_FOUND: "SALESFORCE_ACCOUNT_NOT_FOUND",
LINKING_FAILED: "LINKING_FAILED",
} as const;
export type AuthErrorCode = (typeof AUTH_ERROR_CODE)[keyof typeof AUTH_ERROR_CODE];
// ============================================================================
// Token Type Constants
// ============================================================================
export const TOKEN_TYPE = {
BEARER: "Bearer",
} as const;
export type TokenTypeValue = (typeof TOKEN_TYPE)[keyof typeof TOKEN_TYPE];
// ============================================================================
// Gender Constants
// ============================================================================
export const GENDER = {
MALE: "male",
FEMALE: "female",
OTHER: "other",
} as const;
export type GenderValue = (typeof GENDER)[keyof typeof GENDER];
// ============================================================================
// Re-export Types from Schema (Schema-First Approach)
// ============================================================================
export type {
// Request types
LoginRequest,
SignupRequest,
PasswordResetRequest,
ResetPasswordRequest,
SetPasswordRequest,
ChangePasswordRequest,
LinkWhmcsRequest,
ValidateSignupRequest,
UpdateCustomerProfileRequest,
AccountStatusRequest,
SsoLinkRequest,
CheckPasswordNeededRequest,
RefreshTokenRequest,
// Token types
AuthTokens,
// Response types
AuthResponse,
SignupResult,
PasswordChangeResult,
SsoLinkResponse,
CheckPasswordNeededResponse,
LinkWhmcsResponse,
// Error types
AuthError,
} from './schema';