From adac5a1538a98ba4eff5284f5da3e7489c0b66ca Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Sun, 16 Jul 2023 21:02:59 -0600 Subject: [PATCH] chore: I hate formatting shit --- backend/data.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/backend/data.ts b/backend/data.ts index f4c76d9..4736873 100644 --- a/backend/data.ts +++ b/backend/data.ts @@ -108,12 +108,12 @@ export const put = (sector: DataSector, key: NID, data: AssFile | AssUser): Prom const useSql = MySql.ready; if (sector === 'files') { - data = data as AssFile; // * 1: Save as files (image, video, etc) - - // ? Local JSON + data = data as AssFile; if (!useSql) { + + // ? Local JSON const filesJson = await fs.readJson(PATHS.files) as FilesSchema; // Check if key already exists @@ -129,14 +129,17 @@ export const put = (sector: DataSector, key: NID, data: AssFile | AssUser): Prom // Save the files await bothWriter(filesJson, usersJson); + } else { + + // ? SQL } } else { - data = data as AssUser; // * 2: Save as users - - // ? Local JSON + data = data as AssUser; if (!useSql) { + + // ? Local JSON const usersJson = await fs.readJson(PATHS.users) as UsersSchema; // Check if key already exists @@ -146,6 +149,9 @@ export const put = (sector: DataSector, key: NID, data: AssFile | AssUser): Prom usersJson.users[key] = data; await fs.writeJson(PATHS.users, usersJson, { spaces: '\t' }); + } else { + + // ? SQL } }