From 285e5ccc6a1495e428f739d376a6f6cf3d0958cd Mon Sep 17 00:00:00 2001 From: Josh Moore Date: Sun, 15 Oct 2023 12:00:51 -0600 Subject: [PATCH] feat: added getAll to `data.ts` (MySQL is UNTESTED) --- backend/data.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/data.ts b/backend/data.ts index 65321ab..2295faf 100644 --- a/backend/data.ts +++ b/backend/data.ts @@ -178,3 +178,15 @@ export const get = (sector: DataSector, key: NID): Promise => new Promise(async (resolve, reject) => { + try { + const data: { [key: string]: AssFile | AssUser } | undefined = (MySql.ready) + // todo: fix MySQL + ? (await MySql.getAll(sector === 'files' ? 'assfiles' : 'assusers') as /* AssFile[] | AssUser[] | */ undefined) + : (await fs.readJson(PATHS[sector]))[sector]; + (!data) ? resolve(false) : resolve(data); + } catch (err) { + reject(err); + } +});