adjust so DB calls go to the factory
This commit is contained in:
@@ -7,6 +7,7 @@ import { Filesystem, Directory, Encoding } from "@capacitor/filesystem";
|
||||
import { Camera, CameraResultType, CameraSource } from "@capacitor/camera";
|
||||
import { Share } from "@capacitor/share";
|
||||
import { logger } from "../../utils/logger";
|
||||
import { QueryExecResult } from "@/interfaces/database";
|
||||
|
||||
/**
|
||||
* Platform service implementation for Capacitor (mobile) platform.
|
||||
@@ -476,4 +477,11 @@ export class CapacitorPlatformService implements PlatformService {
|
||||
// This is just a placeholder for the interface
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
dbQuery(sql: string, params?: unknown[]): Promise<QueryExecResult> {
|
||||
throw new Error("Not implemented for " + sql + " with params " + params);
|
||||
}
|
||||
dbExec(sql: string, params?: unknown[]): Promise<{ changes: number; lastId?: number }> {
|
||||
throw new Error("Not implemented for " + sql + " with params " + params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
PlatformCapabilities,
|
||||
} from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
import { QueryExecResult } from "@/interfaces/database";
|
||||
|
||||
/**
|
||||
* Platform service implementation for Electron (desktop) platform.
|
||||
@@ -108,4 +109,11 @@ export class ElectronPlatformService implements PlatformService {
|
||||
logger.error("handleDeepLink not implemented in Electron platform");
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
dbQuery(sql: string, params?: unknown[]): Promise<QueryExecResult> {
|
||||
throw new Error("Not implemented for " + sql + " with params " + params);
|
||||
}
|
||||
dbExec(sql: string, params?: unknown[]): Promise<{ changes: number; lastId?: number }> {
|
||||
throw new Error("Not implemented for " + sql + " with params " + params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
PlatformCapabilities,
|
||||
} from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
import { QueryExecResult } from "@/interfaces/database";
|
||||
|
||||
/**
|
||||
* Platform service implementation for PyWebView platform.
|
||||
@@ -109,4 +110,11 @@ export class PyWebViewPlatformService implements PlatformService {
|
||||
logger.error("handleDeepLink not implemented in PyWebView platform");
|
||||
throw new Error("Not implemented");
|
||||
}
|
||||
|
||||
dbQuery(sql: string, params?: unknown[]): Promise<QueryExecResult> {
|
||||
throw new Error("Not implemented for " + sql + " with params " + params);
|
||||
}
|
||||
dbExec(sql: string, params?: unknown[]): Promise<{ changes: number; lastId?: number }> {
|
||||
throw new Error("Not implemented for " + sql + " with params " + params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import {
|
||||
PlatformCapabilities,
|
||||
} from "../PlatformService";
|
||||
import { logger } from "../../utils/logger";
|
||||
import { QueryExecResult } from "@/interfaces/database";
|
||||
import databaseService from "../database";
|
||||
|
||||
/**
|
||||
* Platform service implementation for web browser platform.
|
||||
@@ -359,4 +361,18 @@ export class WebPlatformService implements PlatformService {
|
||||
async writeAndShareFile(_fileName: string, _content: string): Promise<void> {
|
||||
throw new Error("File system access not available in web platform");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PlatformService.dbQuery
|
||||
*/
|
||||
dbQuery(sql: string, params?: unknown[]): Promise<QueryExecResult> {
|
||||
return databaseService.query(sql, params).then((result) => result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see PlatformService.dbExec
|
||||
*/
|
||||
dbExec(sql: string, params?: unknown[]): Promise<{ changes: number; lastId?: number }> {
|
||||
return databaseService.run(sql, params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user