refactor(services): align Capacitor and Web platform services with active_identity architecture

- 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
This commit is contained in:
Matthew Raymer
2025-10-02 06:31:03 +00:00
parent 7432525f4c
commit 666bed0efd
2 changed files with 8 additions and 2 deletions

View File

@@ -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];