This commit is contained in:
Benjamin Toby
2025-02-19 20:01:50 +01:00
parent c08db13f3d
commit e9bb9fb07f
113 changed files with 253 additions and 63 deletions
+1
View File
@@ -23,6 +23,7 @@ import grabDSQLConnection from "../utils/grab-dsql-connection";
console.log("Connection Query Success =>", result);
} catch (error: any) {
console.log("Connection query ERROR =>", error.message);
global.ERROR_CALLBACK?.(`Error Checking DB`, error as Error);
} finally {
CONNECTION?.end();
process.exit();
@@ -67,6 +67,10 @@ export default async function checkDbRecordCreateDbSchema({
return recordedDbEntry;
} catch (error) {
global.ERROR_CALLBACK?.(
`Error Checking DB Record on Creating Schema`,
error as Error
);
return undefined;
}
}
@@ -110,6 +110,10 @@ export default async function checkTableRecordCreateDbSchema({
return recordedTableEntry;
} catch (error) {
global.ERROR_CALLBACK?.(
`Error Checking Table Record on Creating Schema`,
error as Error
);
return undefined;
}
}
@@ -42,6 +42,11 @@ export default async function handleIndexescreateDbFromSchema({
if (!existingKeyInDb[0])
throw new Error("This Index Does not Exist");
} catch (error) {
global.ERROR_CALLBACK?.(
`Error Handling Indexes on Creating Schema`,
error as Error
);
/**
* @description Create new index if determined that it
* doesn't exist in MYSQL db
@@ -250,7 +250,10 @@ export default async function refreshUsersAndGrants({
}
}
} catch (error: any) {
console.log(`Error in adding SQL user =>`, error.message);
global.ERROR_CALLBACK?.(
`Error Refreshing MariaDB Users and Grants`,
error as Error
);
}
}
}
@@ -59,9 +59,9 @@ async function resetSQLCredentialsPasswords() {
);
}
} catch (error: any) {
console.log(
`Error Updating User ${user.id} Password =>`,
error.message
global.ERROR_CALLBACK?.(
`Error Resetting MariaDB User Password`,
error as Error
);
}
}
@@ -168,7 +168,7 @@ async function createUser() {
return true;
} catch (error: any) {
console.log(`Error in creating user => ${error.message}`);
global.ERROR_CALLBACK?.(`Error Creating User`, error as Error);
return false;
}
}
@@ -56,7 +56,7 @@ async function createUser() {
return true;
} catch (error: any) {
console.log(`Error in creating user => ${error.message}`);
global.ERROR_CALLBACK?.(`Error Updating User`, error as Error);
return false;
}
}
@@ -66,6 +66,10 @@ async function resetSQLCredentials() {
`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`
);
} catch (error: any) {
global.ERROR_CALLBACK?.(
`Error Resetting SQL credentials`,
error as Error
);
console.log(`Error in adding SQL user =>`, error.message);
}
}
@@ -47,9 +47,9 @@ async function resetSQLCredentialsPasswords() {
`User ${user.id}: ${user.first_name} ${user.last_name} Password Updated successfully added.`
);
} catch (error: any) {
console.log(
`Error Updating User ${user.id} Password =>`,
error.message
global.ERROR_CALLBACK?.(
`Error Updating MariaDB User`,
error as Error
);
}
}
+4 -1
View File
@@ -60,7 +60,10 @@ async function setSQLCredentials() {
`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`
);
} catch (error: any) {
console.log(`Error in adding SQL user =>`, error.message);
global.ERROR_CALLBACK?.(
`Error Setting SQL credentials`,
error as Error
);
}
}
}
+4 -1
View File
@@ -27,7 +27,10 @@ import grabDSQLConnection from "../utils/grab-dsql-connection";
console.log("parsedResults =>", parsedResults);
} catch (error: any) {
console.log("Connection query ERROR =>", error.message);
global.ERROR_CALLBACK?.(
`Error Testing External Server`,
error as Error
);
} finally {
CONNECTION?.end();
process.exit();
+1 -1
View File
@@ -75,7 +75,7 @@ export default async function testSQLEscape() {
`User ${user.id}: ${user.first_name} ${user.last_name} SQL credentials successfully added.`
);
} catch (error: any) {
console.log(`Error in adding SQL user =>`, error.message);
global.ERROR_CALLBACK?.(`Error Testing SQL Escape`, error as Error);
}
}
@@ -45,7 +45,10 @@ async function updateChildrenTablesOnDb() {
}
}
} catch (error) {
console.log(error);
global.ERROR_CALLBACK?.(
`Error Updating Children Tables on DB`,
error as Error
);
}
process.exit();
@@ -42,6 +42,11 @@ varDatabaseDbHandler({
message: error.message,
user: {},
});
global.ERROR_CALLBACK?.(
`Error Updating DB Slugs For Table Records`,
error as Error
);
}
}
+1 -1
View File
@@ -46,7 +46,7 @@ import grabDSQLConnection from "../utils/grab-dsql-connection";
console.log(`addUserSSL => ${User}@${Host}`, addUserSSL);
}
} catch (error: any) {
console.log("Connection query ERROR =>", error.message);
global.ERROR_CALLBACK?.(`Error Updating SSL Users`, error as Error);
} finally {
CONNECTION.end();
process.exit();
+2
View File
@@ -26,6 +26,8 @@ export default async function dbHandler({
results = await CONNECTION.query(query);
}
} catch (error: any) {
global.ERROR_CALLBACK?.(`DB Handler Error...`, error as Error);
if (process.env.FIRST_RUN) {
return null;
}
@@ -8,7 +8,7 @@ export default async function noDatabaseDbHandler(
try {
results = await dbHandler({ query: queryString });
} catch (error: any) {
console.log("ERROR in noDatabaseDbHandler =>", error.message);
global.ERROR_CALLBACK?.(`No DB Handler Error`, error as Error);
}
if (results) {