|
|
@ -47,6 +47,7 @@ import type { |
|
|
|
import { MASTER_SETTINGS_KEY, type Settings } from "@/db/tables/settings"; |
|
|
|
import { logger } from "@/utils/logger"; |
|
|
|
import { Contact } from "@/db/tables/contacts"; |
|
|
|
import { Temp } from "@/db/tables/temp"; |
|
|
|
import { QueryExecResult, DatabaseExecResult } from "@/interfaces/database"; |
|
|
|
import { |
|
|
|
generateInsertStatement, |
|
|
@ -954,6 +955,41 @@ export const PlatformServiceMixin = { |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
// =================================================
|
|
|
|
// TEMP TABLE METHODS (for temporary storage)
|
|
|
|
// =================================================
|
|
|
|
|
|
|
|
/** |
|
|
|
* Get temporary data by ID - $getTemp() |
|
|
|
* Retrieves temporary data from the temp table |
|
|
|
* @param id Temporary storage ID |
|
|
|
* @returns Promise<Temp | null> Temporary data or null if not found |
|
|
|
*/ |
|
|
|
async $getTemp(id: string): Promise<Temp | null> { |
|
|
|
try { |
|
|
|
return await this.$first<Temp>("SELECT * FROM temp WHERE id = ?", [id]); |
|
|
|
} catch (error) { |
|
|
|
logger.error("[PlatformServiceMixin] Error getting temp data:", error); |
|
|
|
return null; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Delete temporary data by ID - $deleteTemp() |
|
|
|
* Removes temporary data from the temp table |
|
|
|
* @param id Temporary storage ID |
|
|
|
* @returns Promise<boolean> Success status |
|
|
|
*/ |
|
|
|
async $deleteTemp(id: string): Promise<boolean> { |
|
|
|
try { |
|
|
|
await this.$dbExec("DELETE FROM temp WHERE id = ?", [id]); |
|
|
|
return true; |
|
|
|
} catch (error) { |
|
|
|
logger.error("[PlatformServiceMixin] Error deleting temp data:", error); |
|
|
|
return false; |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
/** |
|
|
|
* Generic entity insertion - $insertEntity() |
|
|
|
* Eliminates verbose INSERT patterns for any entity |
|
|
@ -1261,6 +1297,8 @@ export interface IPlatformServiceMixin { |
|
|
|
did: string, |
|
|
|
settings: Partial<Settings>, |
|
|
|
): Promise<boolean>; |
|
|
|
$getTemp(id: string): Promise<Temp | null>; |
|
|
|
$deleteTemp(id: string): Promise<boolean>; |
|
|
|
|
|
|
|
// Logging methods
|
|
|
|
$log(message: string, level?: string): Promise<void>; |
|
|
@ -1381,6 +1419,8 @@ declare module "@vue/runtime-core" { |
|
|
|
did: string, |
|
|
|
settings: Partial<Settings>, |
|
|
|
): Promise<boolean>; |
|
|
|
$getTemp(id: string): Promise<Temp | null>; |
|
|
|
$deleteTemp(id: string): Promise<boolean>; |
|
|
|
|
|
|
|
// Logging methods
|
|
|
|
$log(message: string, level?: string): Promise<void>; |
|
|
|