forked from jsnbuchanan/crowd-funder-for-time-pwa
fix platform services to use correct settings table schema
- Fix WebPlatformService settings methods to use id/accountDid columns - Fix CapacitorPlatformService settings methods to use id/accountDid columns - Replace WHERE key = 'default' with WHERE id = 1 for default settings - Replace WHERE key = ? with WHERE accountDid = ? for user settings - Update insertDidSpecificSettings to use accountDid column - Update retrieveSettingsForActiveAccount to select all columns and convert to object - Resolves "no such column: key" SQL errors after util.ts migration - Ensures compatibility with new settings table structure All platform services now use correct database schema for settings operations.
This commit is contained in:
@@ -33,7 +33,6 @@ import { logger } from "../utils/logger";
|
||||
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
|
||||
import { IIdentifier } from "@veramo/core";
|
||||
import { DEFAULT_ROOT_DERIVATION_PATH } from "./crypto";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
|
||||
// Self-contained utility functions to replace databaseUtil dependencies
|
||||
function parseJsonField<T>(value: unknown, defaultValue: T): T {
|
||||
@@ -667,9 +666,9 @@ export async function saveNewIdentity(
|
||||
];
|
||||
await platformService.dbExec(sql, params);
|
||||
|
||||
await databaseUtil.updateDefaultSettings({ activeDid: identity.did });
|
||||
await platformService.updateDefaultSettings({ activeDid: identity.did });
|
||||
|
||||
await databaseUtil.insertDidSpecificSettings(identity.did);
|
||||
await platformService.insertDidSpecificSettings(identity.did);
|
||||
} catch (error) {
|
||||
logger.error("Failed to update default settings:", error);
|
||||
throw new Error(
|
||||
@@ -691,7 +690,8 @@ export const generateSaveAndActivateIdentity = async (): Promise<string> => {
|
||||
const newId = newIdentifier(address, publicHex, privateHex, derivationPath);
|
||||
|
||||
await saveNewIdentity(newId, mnemonic, derivationPath);
|
||||
await databaseUtil.updateDidSpecificSettings(newId.did, {
|
||||
const platformService = await getPlatformService();
|
||||
await platformService.updateDidSpecificSettings(newId.did, {
|
||||
isRegistered: false,
|
||||
});
|
||||
return newId.did;
|
||||
|
||||
Reference in New Issue
Block a user