Replace loose z.string() fields in supportCaseSchema and supportCaseFilterSchema with the already-defined enum schemas (status, priority, category). Add JSDoc to intentional escape hatches in customer contract interfaces. Fix portal type assertions for the stricter filter types.
77 lines
2.2 KiB
TypeScript
77 lines
2.2 KiB
TypeScript
/**
|
|
* Customer Domain - Contract
|
|
*
|
|
* Constants and provider-specific types.
|
|
* Main domain types exported from schema.ts
|
|
*
|
|
* Pattern matches billing and subscriptions domains.
|
|
*/
|
|
|
|
// ============================================================================
|
|
// User Role Constants
|
|
// ============================================================================
|
|
|
|
export const USER_ROLE = {
|
|
USER: "USER",
|
|
ADMIN: "ADMIN",
|
|
} as const;
|
|
|
|
export type UserRoleValue = (typeof USER_ROLE)[keyof typeof USER_ROLE];
|
|
|
|
// ============================================================================
|
|
// Salesforce Integration Types (Provider-Specific, Not Validated)
|
|
// ============================================================================
|
|
|
|
/**
|
|
* Salesforce account field mapping
|
|
* This is provider-specific and not validated at runtime
|
|
*/
|
|
export interface SalesforceAccountFieldMap {
|
|
internetEligibility: string;
|
|
customerNumber: string;
|
|
}
|
|
|
|
/**
|
|
* Raw Salesforce record — intentionally permissive.
|
|
* The Salesforce API returns org-specific fields that vary by configuration.
|
|
* Domain mappers validate specific fields; unknown fields are ignored.
|
|
*/
|
|
export interface SalesforceAccountRecord {
|
|
Id: string;
|
|
Name?: string | null;
|
|
WH_Account__c?: string | null;
|
|
[key: string]: unknown;
|
|
}
|
|
|
|
/**
|
|
* Raw Salesforce record — intentionally permissive.
|
|
* The Salesforce API returns org-specific fields that vary by configuration.
|
|
* Domain mappers validate specific fields; unknown fields are ignored.
|
|
*/
|
|
export interface SalesforceContactRecord {
|
|
Id: string;
|
|
AccountId?: string | null;
|
|
FirstName?: string | null;
|
|
LastName?: string | null;
|
|
Email?: string | null;
|
|
MobilePhone?: string | null;
|
|
Phone?: string | null;
|
|
Sex__c?: string | null;
|
|
Birthdate?: string | null; // YYYY-MM-DD format
|
|
[key: string]: unknown;
|
|
}
|
|
|
|
// ============================================================================
|
|
// Re-export Types from Schema (Schema-First Approach)
|
|
// ============================================================================
|
|
|
|
export type {
|
|
User,
|
|
UserAuth,
|
|
UserRole,
|
|
Address,
|
|
AddressFormData,
|
|
ResidenceCardVerificationStatus,
|
|
ResidenceCardVerification,
|
|
} from "./schema.js";
|