2025-01-10 19:10:28 +00:00
|
|
|
import dbHandler from "./dbHandler";
|
2024-12-06 10:31:24 +00:00
|
|
|
|
|
|
|
/**
|
2025-01-10 19:10:28 +00:00
|
|
|
* # Create database from Schema Function
|
2024-12-06 10:31:24 +00:00
|
|
|
*/
|
2025-01-10 19:10:28 +00:00
|
|
|
export default async function noDatabaseDbHandler(
|
|
|
|
queryString: string
|
|
|
|
): Promise<any> {
|
2024-12-06 10:31:24 +00:00
|
|
|
/**
|
|
|
|
* Declare variables
|
|
|
|
*
|
|
|
|
* @description Declare "results" variable
|
|
|
|
*/
|
|
|
|
let results;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Fetch from db
|
|
|
|
*
|
|
|
|
* @description Fetch data from db if no cache
|
|
|
|
*/
|
|
|
|
try {
|
|
|
|
/** ********************* Run Query */
|
|
|
|
results = await dbHandler({ query: queryString });
|
|
|
|
|
|
|
|
////////////////////////////////////////
|
|
|
|
////////////////////////////////////////
|
|
|
|
////////////////////////////////////////
|
2025-01-10 19:10:28 +00:00
|
|
|
} catch (error: any) {
|
2024-12-06 10:31:24 +00:00
|
|
|
console.log("ERROR in noDatabaseDbHandler =>", error.message);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return results
|
|
|
|
*
|
|
|
|
* @description Return results add to cache if "req" param is passed
|
|
|
|
*/
|
|
|
|
if (results) {
|
|
|
|
return results;
|
|
|
|
} else {
|
|
|
|
return null;
|
|
|
|
}
|
2025-01-10 19:10:28 +00:00
|
|
|
}
|