Files
orangecat/tests/unit/client.ts
g-butandClaude Opus 4.6 11b9960f63 refactor(db): Phase 0+1 — profile-actor sync + drop 16 dead columns
Phase 0A: Database trigger syncs profiles → actors on name/username/
avatar changes. Profiles is now SSOT for identity; actors is derived.

Phase 0B: Actor created eagerly at signup (ensureProfile calls
getOrCreateUserActor). Eliminates lazy-creation gap where Cat and
other services couldn't find the actor for new users.

Phase 1: Remove 16 dead columns from profiles (63 → ~47 columns):
- Always-zero counters: follower_count, following_count, profile_views,
  login_count, campaign_count, total_raised, total_donated
- Duplicate balances: bitcoin_balance, lightning_balance (real data
  in wallets table)
- Never-used: theme_preferences, custom_css, profile_color,
  profile_badges, cover_image_url, two_factor_enabled
- Deprecated: display_name (replaced by name, now synced via trigger)

Code changes: removed ProfileAnalytics type, updateAnalytics() dead
method, hardcoded-zero defaults in mapper/writer, dead field references
in ProfileWalletsTab and test client.

Migration files added (not yet applied to remote DB):
- 20260404000000_sync_profiles_to_actors.sql
- 20260404000001_drop_dead_profile_columns.sql

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-04 21:26:35 +02:00

45 lines
1.7 KiB
TypeScript

/**
* TEST CLIENT - BACKWARDS COMPATIBILITY FOR TESTS
*
* This file provides backwards compatibility for tests that expect
* a unified client that re-exports all services.
*/
// Re-export auth service
export {
signIn,
signUp,
signOut,
resetPassword,
updatePassword,
getSession,
getUser,
onAuthStateChange,
isAuthenticated,
getCurrentUserId,
} from '@/services/supabase/auth';
// Re-export profile service
import { ProfileService } from '@/services/profile';
export { ProfileService };
// For backwards compatibility, export profile functions individually
export const getProfile = ProfileService.getProfile.bind(ProfileService);
export const updateProfile = ProfileService.updateProfile.bind(ProfileService);
export const createProfile = ProfileService.createProfile.bind(ProfileService);
export const getProfiles = ProfileService.getProfiles.bind(ProfileService);
export const searchProfiles = ProfileService.searchProfiles.bind(ProfileService);
export const getAllProfiles = ProfileService.getAllProfiles.bind(ProfileService);
export const incrementProfileViews = ProfileService.incrementProfileViews.bind(ProfileService);
export const deleteProfile = ProfileService.deleteProfile.bind(ProfileService);
export const fallbackProfileUpdate = ProfileService.fallbackProfileUpdate.bind(ProfileService);
// Mock functions for backwards compatibility
export const isUsernameAvailable = async (username: string) => true;
export const getProfileByUsername = async (username: string) => null;
export const validateProfileData = async (data: any) => ({ success: true });
// Import and re-export core clients
import { supabase, supabaseAdmin, supabaseConfig } from '@/services/supabase/core/client';
export { supabase, supabaseAdmin, supabaseConfig };