From 666bed0efd1e8937a1edfb62bd3442ddd57fe546 Mon Sep 17 00:00:00 2001 From: Matthew Raymer Date: Thu, 2 Oct 2025 06:31:03 +0000 Subject: [PATCH] refactor(services): align Capacitor and Web platform services with active_identity architecture MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update CapacitorPlatformService.updateDefaultSettings() to use active_identity table instead of hard-coded id=1 - Update CapacitorPlatformService.retrieveSettingsForActiveAccount() to query by accountDid from active_identity - Add getActiveIdentity() method to CapacitorPlatformService for consistency with WebPlatformService - Update WebPlatformService.retrieveSettingsForActiveAccount() to match CapacitorPlatformService pattern - Both services now consistently use active_identity table instead of legacy MASTER_SETTINGS_KEY approach - Maintains backward compatibility with databaseUtil.ts for PWA migration support Technical details: - CapacitorPlatformService: Fixed hard-coded WHERE id = 1 → WHERE accountDid = ? - WebPlatformService: Fixed retrieval pattern to match new architecture - Platform services now aligned with migration 004 active_identity table schema - databaseUtil.ts remains unchanged for PWA-to-SQLite migration bridge --- src/services/platforms/CapacitorPlatformService.ts | 5 ++++- src/services/platforms/WebPlatformService.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/services/platforms/CapacitorPlatformService.ts b/src/services/platforms/CapacitorPlatformService.ts index 57df0f9a..ce9e1267 100644 --- a/src/services/platforms/CapacitorPlatformService.ts +++ b/src/services/platforms/CapacitorPlatformService.ts @@ -1413,7 +1413,10 @@ export class CapacitorPlatformService implements PlatformService { return null; } - const result = await this.dbQuery("SELECT * FROM settings WHERE accountDid = ?", [activeDid]); + const result = await this.dbQuery( + "SELECT * FROM settings WHERE accountDid = ?", + [activeDid], + ); if (result?.values?.[0]) { // Convert the row to an object const row = result.values[0]; diff --git a/src/services/platforms/WebPlatformService.ts b/src/services/platforms/WebPlatformService.ts index 944bbe80..0d5605bb 100644 --- a/src/services/platforms/WebPlatformService.ts +++ b/src/services/platforms/WebPlatformService.ts @@ -761,7 +761,10 @@ export class WebPlatformService implements PlatformService { return null; } - const result = await this.dbQuery("SELECT * FROM settings WHERE accountDid = ?", [activeDid]); + const result = await this.dbQuery( + "SELECT * FROM settings WHERE accountDid = ?", + [activeDid], + ); if (result?.values?.[0]) { // Convert the row to an object const row = result.values[0];