This commit is contained in:
Benjamin Toby
2025-01-12 18:19:20 +01:00
parent a3561da53d
commit 186cc76ffb
46 changed files with 344 additions and 211 deletions
@@ -93,7 +93,7 @@ export default async function githubLogin({
}
} catch (/** @type {any} */ error: any) {
console.log(
"ERROR in githubLogin.js backend function =>",
"ERROR in githubLogin.ts backend function =>",
error.message
);
}
@@ -221,19 +221,19 @@ export default async function handleSocialDb({
});
} else {
console.log(
"Social User Failed to insert in 'handleSocialDb.js' backend function =>",
"Social User Failed to insert in 'handleSocialDb.ts' backend function =>",
newUser
);
return {
success: false,
payload: null,
msg: "Social User Failed to insert in 'handleSocialDb.js' backend function",
msg: "Social User Failed to insert in 'handleSocialDb.ts' backend function",
};
}
} catch (error: any) {
console.log(
"ERROR in 'handleSocialDb.js' backend function =>",
"ERROR in 'handleSocialDb.ts' backend function =>",
error.message
);
@@ -96,7 +96,7 @@ export default async function apiGoogleLogin({
return { ...loggedInGoogleUser };
} catch (/** @type {any} */ error: any) {
console.log(`apo-google-login.js ERROR: ${error.message}`);
console.log(`api-google-login.ts ERROR: ${error.message}`);
return {
success: false,
@@ -85,7 +85,7 @@ export default async function addUsersTableToDb({
return `Done!`;
} catch (/** @type {any} */ error: any) {
console.log(`addUsersTableToDb.js ERROR: ${error.message}`);
console.log(`addUsersTableToDb.ts ERROR: ${error.message}`);
serverError({
component: "addUsersTableToDb",
@@ -6,7 +6,7 @@ import _ from "lodash";
* @description this function takes in a text(or number) and returns a sanitized
* text, usually without spaces
*/
function sanitizeSql(text: any, spaces: boolean, regex?: RegExp | null): any {
function sanitizeSql(text: any, spaces?: boolean, regex?: RegExp | null): any {
if (!text) return "";
if (typeof text == "number" || typeof text == "boolean") return text;
if (typeof text == "string" && !text?.toString()?.match(/./)) return "";
@@ -55,7 +55,7 @@ function sanitizeSql(text: any, spaces: boolean, regex?: RegExp | null): any {
*
* @returns {object}
*/
function sanitizeObjects(object: any, spaces: boolean): object {
function sanitizeObjects(object: any, spaces?: boolean): object {
/** @type {any} */
let objectUpdated: any = { ...object };
const keys = Object.keys(objectUpdated);
@@ -92,7 +92,7 @@ function sanitizeObjects(object: any, spaces: boolean): object {
*/
function sanitizeArrays(
array: any[],
spaces: boolean
spaces?: boolean
): string[] | number[] | object[] {
let arrayUpdated = _.cloneDeep(array);
@@ -36,7 +36,7 @@ export default function grabNewUsersTableSchema(params: {
return userPreset;
} catch (/** @type {any} */ error: any) {
console.log(`grabNewUsersTableSchema.js ERROR: ${error.message}`);
console.log(`grabNewUsersTableSchema.ts ERROR: ${error.message}`);
serverError({
component: "grabNewUsersTableSchema",
@@ -75,10 +75,10 @@ export default function grabSchemaFieldsFromData({
return finalFields;
} catch (/** @type {any} */ error: any) {
console.log(`grabSchemaFieldsFromData.js ERROR: ${error.message}`);
console.log(`grabSchemaFieldsFromData.ts ERROR: ${error.message}`);
serverError({
component: "grabSchemaFieldsFromData.js",
component: "grabSchemaFieldsFromData.ts",
message: error.message,
});
@@ -1,5 +1,5 @@
import fs from "fs";
import nodemailer, { SendMailOptions } from "nodemailer";
import nodemailer from "nodemailer";
let transporter = nodemailer.createTransport({
host: process.env.DSQL_MAIL_HOST,
@@ -68,7 +68,7 @@ export default async function handleNodemailer({
////////////////////////////////////////
try {
let mailObject: SendMailOptions = {};
let mailObject: any = {};
mailObject["from"] = `"${senderName || "Datasquirel"}" <${sender}>`;
mailObject["sender"] = sender;
@@ -65,7 +65,7 @@ export default async function updateUsersTableSchema({
return `Done!`;
} catch (error: any) {
console.log(`addUsersTableToDb.js ERROR: ${error.message}`);
console.log(`addUsersTableToDb.ts ERROR: ${error.message}`);
serverError({
component: "addUsersTableToDb",
-2
View File
@@ -56,5 +56,3 @@ export default function encrypt({
return data;
}
}
module.exports = encrypt;