Browse Source

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
pull/204/head
Matthew Raymer 2 weeks ago
parent
commit
666bed0efd
  1. 5
      src/services/platforms/CapacitorPlatformService.ts
  2. 5
      src/services/platforms/WebPlatformService.ts

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

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

Loading…
Cancel
Save