Updates
This commit is contained in:
@@ -24,7 +24,8 @@ const varDatabaseDbHandler_1 = __importDefault(require("../../backend/varDatabas
|
||||
function loginSocialUser(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ user, social_platform, invitation, database, additionalFields, useLocal, }) {
|
||||
const finalDbName = database ? database : "datasquirel";
|
||||
const foundUserQuery = `SELECT * FROM \`${finalDbName}\`.\`users\` WHERE email=? AND social_id=? AND social_platform=?`;
|
||||
const dbAppend = database ? `\`${finalDbName}\`.` : "";
|
||||
const foundUserQuery = `SELECT * FROM ${dbAppend}\`users\` WHERE email=? AND social_id=? AND social_platform=?`;
|
||||
const foundUserValues = [user.email, user.social_id, social_platform];
|
||||
const foundUser = yield (0, varDatabaseDbHandler_1.default)({
|
||||
database: finalDbName,
|
||||
@@ -40,7 +41,6 @@ function loginSocialUser(_a) {
|
||||
let csrfKey = Math.random().toString(36).substring(2) +
|
||||
"-" +
|
||||
Math.random().toString(36).substring(2);
|
||||
/** @type {import("../../../types").DATASQUIREL_LoggedInUser} */
|
||||
let userPayload = {
|
||||
id: foundUser[0].id,
|
||||
first_name: foundUser[0].first_name,
|
||||
@@ -70,7 +70,6 @@ function loginSocialUser(_a) {
|
||||
useLocal,
|
||||
});
|
||||
}
|
||||
/** @type {import("../../../types").APILoginFunctionReturn} */
|
||||
let result = {
|
||||
success: true,
|
||||
payload: userPayload,
|
||||
|
||||
@@ -60,7 +60,6 @@ function apiGoogleLogin(_a) {
|
||||
* @description Create new user folder and file
|
||||
*/
|
||||
const { given_name, family_name, email, sub, picture } = gUser;
|
||||
/** @type {Object<string, any>} */
|
||||
let payloadObject = {
|
||||
email: email,
|
||||
first_name: given_name,
|
||||
|
||||
@@ -22,7 +22,7 @@ const conn_db_handler_1 = __importDefault(require("../../utils/db/conn-db-handle
|
||||
*/
|
||||
function varDatabaseDbHandler(_a) {
|
||||
return __awaiter(this, arguments, void 0, function* ({ queryString, queryValuesArray, database, tableSchema, useLocal, debug, }) {
|
||||
let CONNECTION = (0, grab_dsql_connection_1.default)({ fa: true });
|
||||
let CONNECTION = (0, grab_dsql_connection_1.default)({ fa: true, local: useLocal });
|
||||
if (useLocal)
|
||||
CONNECTION = (0, grab_dsql_connection_1.default)({ local: true });
|
||||
if (database === null || database === void 0 ? void 0 : database.match(/^datasquirel$/))
|
||||
|
||||
+18
-1
@@ -9,8 +9,25 @@ const serverless_mysql_1 = __importDefault(require("serverless-mysql"));
|
||||
* # Grab General CONNECTION for DSQL
|
||||
*/
|
||||
function grabDSQLConnection(param) {
|
||||
if (param === null || param === void 0 ? void 0 : param.local) {
|
||||
return (global.DSQL_DB_CONN ||
|
||||
(0, serverless_mysql_1.default)({
|
||||
config: {
|
||||
host: process.env.DSQL_DB_HOST,
|
||||
user: process.env.DSQL_DB_USERNAME,
|
||||
password: process.env.DSQL_DB_PASSWORD,
|
||||
database: (param === null || param === void 0 ? void 0 : param.noDb)
|
||||
? undefined
|
||||
: process.env.DSQL_DB_NAME,
|
||||
port: process.env.DSQL_DB_PORT
|
||||
? Number(process.env.DSQL_DB_PORT)
|
||||
: undefined,
|
||||
charset: "utf8mb4",
|
||||
},
|
||||
}));
|
||||
}
|
||||
if (param === null || param === void 0 ? void 0 : param.ro) {
|
||||
return (DSQL_READ_ONLY_DB_CONN ||
|
||||
return (global.DSQL_READ_ONLY_DB_CONN ||
|
||||
(0, serverless_mysql_1.default)({
|
||||
config: {
|
||||
host: process.env.DSQL_DB_HOST,
|
||||
|
||||
Reference in New Issue
Block a user