forked from jsnbuchanan/crowd-funder-for-time-pwa
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user