Merge branch 'active_did_redux' of ssh://173.199.124.46:222/trent_larson/crowd-funder-for-time-pwa into active_did_redux

This commit is contained in:
Matthew Raymer
2025-09-09 06:14:26 +00:00
19 changed files with 686 additions and 197 deletions

View File

@@ -52,7 +52,11 @@ import { logger } from "@/utils/logger";
import { Contact, ContactMaybeWithJsonStrings } from "@/db/tables/contacts";
import { Account } from "@/db/tables/accounts";
import { Temp } from "@/db/tables/temp";
import { QueryExecResult, DatabaseExecResult } from "@/interfaces/database";
import {
QueryExecResult,
DatabaseExecResult,
SqlValue,
} from "@/interfaces/database";
import {
generateInsertStatement,
generateUpdateStatement,
@@ -285,7 +289,7 @@ export const PlatformServiceMixin = {
return [];
}
return result.values.map((row: unknown[]) => row[0] as string);
return result.values.map((row: SqlValue[]) => row[0] as string);
} catch (error) {
logger.error(
"[PlatformServiceMixin] Error getting available account DIDs:",
@@ -498,7 +502,10 @@ export const PlatformServiceMixin = {
/**
* Enhanced database single row query method with error handling
*/
async $dbGetOneRow(sql: string, params?: unknown[]) {
async $dbGetOneRow(
sql: string,
params?: unknown[],
): Promise<SqlValue[] | undefined> {
try {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return await (this as any).platformService.dbGetOneRow(sql, params);
@@ -699,7 +706,7 @@ export const PlatformServiceMixin = {
if (availableAccounts?.values?.length) {
const accountDids = availableAccounts.values.map(
(row: unknown[]) => row[0] as string,
(row: SqlValue[]) => row[0] as string,
);
logger.debug(
"[PlatformServiceMixin] Available accounts for user selection:",
@@ -845,7 +852,7 @@ export const PlatformServiceMixin = {
async $one(
sql: string,
params: unknown[] = [],
): Promise<unknown[] | undefined> {
): Promise<SqlValue[] | undefined> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
return await (this as any).platformService.dbGetOneRow(sql, params);
},
@@ -1491,24 +1498,6 @@ export const PlatformServiceMixin = {
}
},
/**
* Get all account DIDs - $getAllAccountDids()
* Retrieves all account DIDs from the accounts table
* @returns Promise<string[]> Array of account DIDs
*/
async $getAllAccountDids(): Promise<string[]> {
try {
const accounts = await this.$query<Account>("SELECT did FROM accounts");
return accounts.map((account) => account.did);
} catch (error) {
logger.error(
"[PlatformServiceMixin] Error getting all account DIDs:",
error,
);
return [];
}
},
// =================================================
// TEMP TABLE METHODS (for temporary storage)
// =================================================
@@ -1907,7 +1896,10 @@ export interface IPlatformServiceMixin {
params?: unknown[],
): Promise<QueryExecResult | undefined>;
$dbExec(sql: string, params?: unknown[]): Promise<DatabaseExecResult>;
$dbGetOneRow(sql: string, params?: unknown[]): Promise<unknown[] | undefined>;
$dbGetOneRow(
sql: string,
params?: unknown[],
): Promise<SqlValue[] | undefined>;
$getMasterSettings(fallback?: Settings | null): Promise<Settings | null>;
$getMergedSettings(
defaultKey: string,
@@ -2011,7 +2003,7 @@ declare module "@vue/runtime-core" {
// Ultra-concise database methods (shortest possible names)
$db(sql: string, params?: unknown[]): Promise<QueryExecResult | undefined>;
$exec(sql: string, params?: unknown[]): Promise<DatabaseExecResult>;
$one(sql: string, params?: unknown[]): Promise<unknown[] | undefined>;
$one(sql: string, params?: unknown[]): Promise<SqlValue[] | undefined>;
// Query + mapping combo methods
$query<T = Record<string, unknown>>(