feat: Implement privacy modernization plan

This commit is contained in:
gpt-engineer-app[bot]
2025-10-14 19:45:39 +00:00
parent 95972a0b22
commit 5313d8e66c
4 changed files with 428 additions and 145 deletions

58
src/types/privacy.ts Normal file
View File

@@ -0,0 +1,58 @@
/**
* Privacy Types
*
* Centralized type definitions for user privacy settings.
*
* Storage:
* - ProfilePrivacySettings: stored in profiles table
* - PrivacySettings: stored in user_preferences.privacy_settings (JSONB)
*
* Security:
* - All privacy settings are validated with Zod before database writes
* - Changes are logged to profile_audit_log for compliance
* - RLS policies ensure users can only modify their own settings
*/
/**
* Privacy settings stored in user_preferences.privacy_settings
*/
export interface PrivacySettings {
activity_visibility: 'public' | 'private';
search_visibility: boolean;
show_location: boolean;
show_age: boolean;
show_avatar: boolean;
show_bio: boolean;
show_activity_stats: boolean;
show_home_park: boolean;
}
/**
* Profile-level privacy settings
*/
export interface ProfilePrivacySettings {
privacy_level: 'public' | 'private';
show_pronouns: boolean;
}
/**
* Combined form data for privacy tab
*/
export interface PrivacyFormData extends ProfilePrivacySettings, PrivacySettings {}
/**
* User block information
*/
export interface UserBlock {
id: string;
blocker_id: string;
blocked_id: string;
reason?: string;
created_at: string;
blocked_profile?: {
user_id: string;
username: string;
display_name?: string;
avatar_url?: string;
};
}