Updates
This commit is contained in:
@@ -30,10 +30,7 @@ type Param<T = { [k: string]: any }> = {
|
||||
/**
|
||||
* # Query DSQL API
|
||||
*/
|
||||
export default async function queryDSQLAPI<
|
||||
T = { [k: string]: any },
|
||||
P = { [k: string]: any }
|
||||
>({
|
||||
export default async function queryDSQLAPI<T = { [k: string]: any }>({
|
||||
body,
|
||||
query,
|
||||
useDefault,
|
||||
@@ -42,7 +39,7 @@ export default async function queryDSQLAPI<
|
||||
apiKey,
|
||||
apiConnectionConfig,
|
||||
grabbedHostnames,
|
||||
}: Param<T>): Promise<APIResponseObject<P>> {
|
||||
}: Param<T>): Promise<APIResponseObject> {
|
||||
const grabedHostNames =
|
||||
grabbedHostnames || grabHostNames({ useDefault, apiConnectionConfig });
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
@@ -168,7 +165,7 @@ export default async function queryDSQLAPI<
|
||||
httpsRequest.end();
|
||||
});
|
||||
|
||||
return httpResponse as APIResponseObject<P>;
|
||||
return httpResponse as APIResponseObject;
|
||||
} catch (error: any) {
|
||||
return {
|
||||
success: false,
|
||||
|
||||
@@ -152,8 +152,8 @@ export default async function handleSocialDb({
|
||||
},
|
||||
});
|
||||
|
||||
if (newUser?.payload?.insertId) {
|
||||
const newUserQueriedQuery = `SELECT * FROM users WHERE id='${newUser.payload.insertId}'`;
|
||||
if (newUser?.postInsertReturn?.insertId) {
|
||||
const newUserQueriedQuery = `SELECT * FROM users WHERE id='${newUser.postInsertReturn.insertId}'`;
|
||||
|
||||
const newUserQueried = (await dbHandler({
|
||||
database: finalDbName,
|
||||
@@ -175,7 +175,7 @@ export default async function handleSocialDb({
|
||||
*/
|
||||
let generatedToken = encrypt({
|
||||
data: JSON.stringify({
|
||||
id: newUser.payload.insertId,
|
||||
id: newUser.postInsertReturn.insertId,
|
||||
email: supEmail,
|
||||
dateCode: Date.now(),
|
||||
}),
|
||||
|
||||
@@ -163,8 +163,8 @@ export default async function apiCreateUser({
|
||||
},
|
||||
});
|
||||
|
||||
if (addUser?.payload?.insertId) {
|
||||
const newlyAddedUserQuery = `SELECT id,uuid,first_name,last_name,email,username,image,image_thumbnail,verification_status FROM ${dbFullName}.users WHERE id='${addUser.payload.insertId}'`;
|
||||
if (addUser?.postInsertReturn?.insertId) {
|
||||
const newlyAddedUserQuery = `SELECT id,uuid,first_name,last_name,email,username,image,image_thumbnail,verification_status FROM ${dbFullName}.users WHERE id='${addUser.postInsertReturn.insertId}'`;
|
||||
|
||||
const newlyAddedUser = (await dbHandler({
|
||||
query: newlyAddedUserQuery,
|
||||
|
||||
@@ -184,7 +184,7 @@ export default async function apiLoginUser({
|
||||
const resposeObject: APIResponseObject = {
|
||||
success: true,
|
||||
msg: "Login Successful",
|
||||
payload: userPayload,
|
||||
singleRes: userPayload,
|
||||
userId: foundUser[0].id,
|
||||
csrf: csrfKey,
|
||||
};
|
||||
|
||||
@@ -48,6 +48,6 @@ export default async function apiResetUserPassword({
|
||||
|
||||
return {
|
||||
success: true,
|
||||
payload: updateUser,
|
||||
singleRes: updateUser,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -81,6 +81,6 @@ export default async function apiUpdateUser({
|
||||
|
||||
return {
|
||||
success: true,
|
||||
payload: updateUser,
|
||||
singleRes: updateUser,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import handleSocialDb from "../../social-login/handleSocialDb";
|
||||
import githubLogin from "../../social-login/githubLogin";
|
||||
import camelJoinedtoCamelSpace from "../../../../utils/camelJoinedtoCamelSpace";
|
||||
import { APILoginFunctionReturn } from "../../../../types";
|
||||
import { APILoginFunctionReturn, APIResponseObject } from "../../../../types";
|
||||
|
||||
type Param = {
|
||||
code?: string;
|
||||
@@ -24,7 +24,7 @@ export default async function apiGithubLogin({
|
||||
additionalFields,
|
||||
email,
|
||||
additionalData,
|
||||
}: Param): Promise<APILoginFunctionReturn> {
|
||||
}: Param): Promise<APIResponseObject> {
|
||||
if (!code || !clientId || !clientSecret || !database) {
|
||||
return {
|
||||
success: false,
|
||||
|
||||
Reference in New Issue
Block a user