Updates
This commit is contained in:
Vendored
+130
-5
@@ -173,6 +173,7 @@ export interface PackageUserLoginRequestBody {
|
||||
token?: boolean;
|
||||
social?: boolean;
|
||||
dbSchema?: DSQL_DatabaseSchemaType;
|
||||
skipPassword?: boolean;
|
||||
}
|
||||
|
||||
export interface PackageUserLoginLocalBody {
|
||||
@@ -184,6 +185,7 @@ export interface PackageUserLoginLocalBody {
|
||||
token?: boolean;
|
||||
social?: boolean;
|
||||
dbSchema?: DSQL_DatabaseSchemaType;
|
||||
skipPassword?: boolean;
|
||||
}
|
||||
|
||||
type Request = IncomingMessage;
|
||||
@@ -212,7 +214,7 @@ export interface SerializeQueryParams {
|
||||
|
||||
// @ts-check
|
||||
|
||||
export interface DATASQUIREL_LoggedInUser {
|
||||
export type DATASQUIREL_LoggedInUser = {
|
||||
id?: number;
|
||||
first_name: string;
|
||||
last_name: string;
|
||||
@@ -220,7 +222,6 @@ export interface DATASQUIREL_LoggedInUser {
|
||||
phone?: string;
|
||||
user_type?: string;
|
||||
username?: string;
|
||||
password: string;
|
||||
image?: string;
|
||||
image_thumbnail?: string;
|
||||
address?: string;
|
||||
@@ -237,7 +238,7 @@ export interface DATASQUIREL_LoggedInUser {
|
||||
is_admin?: number;
|
||||
admin_level?: number;
|
||||
admin_permissions?: string;
|
||||
uuid: string;
|
||||
uuid?: string;
|
||||
temp_login_code?: string;
|
||||
date_created?: string;
|
||||
date_created_code?: number;
|
||||
@@ -249,7 +250,9 @@ export interface DATASQUIREL_LoggedInUser {
|
||||
logged_in_status?: boolean;
|
||||
date?: number;
|
||||
more_data?: any;
|
||||
}
|
||||
} & {
|
||||
[key: string]: any;
|
||||
};
|
||||
|
||||
export interface AuthenticatedUser {
|
||||
success: boolean;
|
||||
@@ -307,7 +310,7 @@ export interface GetUserFunctionReturn {
|
||||
image: string;
|
||||
image_thumbnail: string;
|
||||
verification_status: [number];
|
||||
};
|
||||
} | null;
|
||||
}
|
||||
|
||||
export interface ReauthUserFunctionReturn {
|
||||
@@ -348,6 +351,9 @@ export type GetSchemaAPIParam = GetSchemaRequestQuery &
|
||||
export interface PostReturn {
|
||||
success: boolean;
|
||||
payload?: Object[] | string | PostInsertReturn;
|
||||
msg?: string;
|
||||
error?: any;
|
||||
schema?: DSQL_TableSchemaType;
|
||||
}
|
||||
|
||||
export interface PostDataPayload {
|
||||
@@ -1251,3 +1257,122 @@ export type MariadbRemoteServerUserObject = {
|
||||
password: string;
|
||||
host: string;
|
||||
};
|
||||
|
||||
export type APILoginFunctionParams = {
|
||||
encryptionKey: string;
|
||||
email: string;
|
||||
username?: string;
|
||||
password?: string;
|
||||
database: string;
|
||||
additionalFields?: string[];
|
||||
email_login?: boolean;
|
||||
email_login_code?: string;
|
||||
email_login_field?: string;
|
||||
token?: boolean;
|
||||
skipPassword?: boolean;
|
||||
social?: boolean;
|
||||
};
|
||||
export type APILoginFunctionReturn = {
|
||||
success: boolean;
|
||||
msg?: string;
|
||||
payload?: DATASQUIREL_LoggedInUser | null;
|
||||
userId?: number | string;
|
||||
};
|
||||
export type APILoginFunction = (
|
||||
params: APILoginFunctionParams
|
||||
) => Promise<APILoginFunctionReturn>;
|
||||
|
||||
export type APICreateUserFunctionParams = {
|
||||
encryptionKey: string;
|
||||
payload: any;
|
||||
database: string;
|
||||
userId?: string | number;
|
||||
};
|
||||
|
||||
export type APICreateUserFunction = (
|
||||
params: APICreateUserFunctionParams
|
||||
) => Promise<AddUserFunctionReturn>;
|
||||
|
||||
/**
|
||||
* API Get User Function
|
||||
*/
|
||||
export type APIGetUserFunctionParams = {
|
||||
fields: string[];
|
||||
dbFullName: string;
|
||||
userId: string | number;
|
||||
};
|
||||
|
||||
export type APIGetUserFunction = (
|
||||
params: APIGetUserFunctionParams
|
||||
) => Promise<GetUserFunctionReturn>;
|
||||
|
||||
/**
|
||||
* API Google Login Function
|
||||
*/
|
||||
export type APIGoogleLoginFunctionParams = {
|
||||
clientId: string;
|
||||
token: string;
|
||||
database: string;
|
||||
userId: string | number;
|
||||
additionalFields?: { [key: string]: any };
|
||||
res: any;
|
||||
};
|
||||
|
||||
export type APIGoogleLoginFunctionReturn = {
|
||||
dsqlUserId?: number | string;
|
||||
} & HandleSocialDbFunctionReturn;
|
||||
|
||||
export type APIGoogleLoginFunction = (
|
||||
params: APIGoogleLoginFunctionParams
|
||||
) => Promise<APIGoogleLoginFunctionReturn>;
|
||||
|
||||
/**
|
||||
* Handle Social DB Function
|
||||
*/
|
||||
export type HandleSocialDbFunctionParams = {
|
||||
database?: string;
|
||||
social_id: string | number;
|
||||
email: string;
|
||||
social_platform: string;
|
||||
payload: any;
|
||||
res?: ServerResponse;
|
||||
invitation?: any;
|
||||
supEmail?: string;
|
||||
additionalFields?: object;
|
||||
};
|
||||
|
||||
export type HandleSocialDbFunctionReturn = {
|
||||
success: boolean;
|
||||
user?: null;
|
||||
msg?: string;
|
||||
social_id?: string | number;
|
||||
social_platform?: string;
|
||||
payload?: any;
|
||||
alert?: boolean;
|
||||
newUser?: any;
|
||||
error?: any;
|
||||
} | null;
|
||||
|
||||
/**
|
||||
* Handle Social User Auth on Datasquirel Database
|
||||
* ==============================================================================
|
||||
*
|
||||
* @description This function handles all social login logic after the social user
|
||||
* has been authenticated and userpayload is present. The payload MUST contain the
|
||||
* specified fields because this funciton will create a new user if the authenticated
|
||||
* user does not exist.
|
||||
*
|
||||
* @param {HandleSocialDbFunctionParams} params - function parameters inside an object
|
||||
*
|
||||
* @returns {Promise<HandleSocialDbFunctionReturn>} - Response object
|
||||
*/
|
||||
export type HandleSocialDbFunction = (
|
||||
params: HandleSocialDbFunctionParams
|
||||
) => Promise<HandleSocialDbFunctionReturn>;
|
||||
|
||||
export type ApiReauthUserReturn = {
|
||||
success: boolean;
|
||||
payload?: { [key: string]: any } | null;
|
||||
msg?: string;
|
||||
userId?: string | number;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user