diff --git a/helpers/functions.database.d.ts b/helpers/functions.database.d.ts index d01aee43..04e6541a 100644 --- a/helpers/functions.database.d.ts +++ b/helpers/functions.database.d.ts @@ -1 +1 @@ -export declare const backupDatabase: () => Promise; +export declare function backupDatabase(): Promise; diff --git a/helpers/functions.database.js b/helpers/functions.database.js index abd29f67..b5a19f18 100644 --- a/helpers/functions.database.js +++ b/helpers/functions.database.js @@ -1,7 +1,7 @@ import fs from 'node:fs/promises'; import { backupFolder, lotOccupancyDB as databasePath } from '../data/databasePaths.js'; -export const backupDatabase = async () => { - const databasePathSplit = databasePath.split(/[/\\]/g); +export async function backupDatabase() { + const databasePathSplit = databasePath.split(/[/\\]/); const backupDatabasePath = `${backupFolder}/${databasePathSplit.at(-1)}.${Date.now().toString()}`; try { await fs.copyFile(databasePath, backupDatabasePath); @@ -10,4 +10,4 @@ export const backupDatabase = async () => { catch { return false; } -}; +} diff --git a/helpers/functions.database.ts b/helpers/functions.database.ts index 0375e4f1..96e710bc 100644 --- a/helpers/functions.database.ts +++ b/helpers/functions.database.ts @@ -5,8 +5,8 @@ import { lotOccupancyDB as databasePath } from '../data/databasePaths.js' -export const backupDatabase = async (): Promise => { - const databasePathSplit = databasePath.split(/[/\\]/g) +export async function backupDatabase(): Promise { + const databasePathSplit = databasePath.split(/[/\\]/) const backupDatabasePath = `${backupFolder}/${databasePathSplit.at(-1)}.${Date.now().toString()}`