fix: Resolve TypeScript linting warnings in CapacitorPlatformService

- Replace 'any' type assertions with specific types in migration name extraction
  * Change '(row as any).name' to '(row as { name: string }).name'
  * Add proper null checks and 'in' operator for property access

- Fix database integrity check type safety
  * Change '(col: any)' to '(col: unknown)' with type guards
  * Use specific type assertion for column name checking

Resolves: @typescript-eslint/no-explicit-any warnings (2 instances)
Impact: Improves type safety without changing functionality
This commit is contained in:
Matthew Raymer
2025-07-01 05:56:28 +00:00
parent 5123cf55b0
commit 8868465216
3 changed files with 382 additions and 238 deletions

View File

@@ -175,10 +175,12 @@ export let memoryLogs: string[] = [];
* @param level - The log level (error, warn, info, debug)
* @author Matthew Raymer
*/
export async function logToDb(message: string, level: string = "info"): Promise<void> {
export async function logToDb(
message: string,
level: string = "info",
): Promise<void> {
const platform = PlatformServiceFactory.getInstance();
const todayKey = new Date().toDateString();
const nowKey = new Date().toISOString();
try {
memoryLogs.push(`${new Date().toISOString()} ${message}`);
@@ -194,12 +196,8 @@ export async function logToDb(message: string, level: string = "info"): Promise<
const sevenDaysAgo = new Date(
new Date().getTime() - 7 * 24 * 60 * 60 * 1000,
).toDateString(); // Use date string to match schema
memoryLogs = memoryLogs.filter(
(log) => log.split(" ")[0] > sevenDaysAgo,
);
await platform.dbExec("DELETE FROM logs WHERE date < ?", [
sevenDaysAgo,
]);
memoryLogs = memoryLogs.filter((log) => log.split(" ")[0] > sevenDaysAgo);
await platform.dbExec("DELETE FROM logs WHERE date < ?", [sevenDaysAgo]);
lastCleanupDate = todayKey;
}
} catch (error) {