This commit is contained in:
Tben 2023-05-18 12:43:52 +01:00
parent 1ae2449467
commit 4e2b0373e0
6 changed files with 49 additions and 60 deletions

View File

@ -23,13 +23,6 @@ const userAuth = require("./users/user-auth");
* ============================================================================== * ==============================================================================
* User Functions Object * User Functions Object
* ============================================================================== * ==============================================================================
* @type {{
* createUser: Function
* loginUser: Function
* logoutUser: Function
* userAuth: Function
* updateUser: Function
* }}
*/ */
const user = { const user = {
createUser: createUser, createUser: createUser,
@ -43,9 +36,6 @@ const user = {
* ============================================================================== * ==============================================================================
* Media Functions Object * Media Functions Object
* ============================================================================== * ==============================================================================
* @type {{
* uploadImage: Function
* }}
*/ */
const media = { const media = {
uploadImage: uploadImage, uploadImage: uploadImage,
@ -55,21 +45,6 @@ const media = {
* ============================================================================== * ==============================================================================
* Main Export * Main Export
* ============================================================================== * ==============================================================================
* @type {{
* get: Function,
* post: Function,
* media: {
* uploadImage: Function
* },
* user: {
* createUser: Function
* loginUser: Function
* logoutUser: Function
* userAuth: Function
* updateUser: Function
* },
* }}
* ==============================================================================
*/ */
const datasquirel = { const datasquirel = {
get: get, get: get,

View File

@ -1,6 +1,6 @@
{ {
"name": "datasquirel", "name": "datasquirel",
"version": "1.1.6", "version": "1.1.7",
"description": "Cloud-based SQL data management tool", "description": "Cloud-based SQL data management tool",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

@ -12,19 +12,25 @@ const https = require("https");
/** ****************************************************************************** */ /** ****************************************************************************** */
/** ****************************************************************************** */ /** ****************************************************************************** */
/**
* @typedef {Promise<object>} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {(Object[]|string)} [payload=[]] - Payload
*/
/** /**
* ============================================================================== * ==============================================================================
* Main Function * Main Function
* ============================================================================== * ==============================================================================
* @param {String} key - API Key * @async
* @param {String} database - Target Database *
* @param {String | Object} payload - User Object. Eg. { * @param {{
first_name: "Benjamin", * key: string,
last_name:"Toby", * payload: string,
email:"benoti.san@gmail.com", * database: string
username:"tben", * }}
password:"12345678", *
} * @returns {FunctionReturn}
*/ */
module.exports = async function ({ key, payload, database }) { module.exports = async function ({ key, payload, database }) {
/** /**

View File

@ -13,24 +13,25 @@ const encrypt = require("../functions/encrypt");
/** ****************************************************************************** */ /** ****************************************************************************** */
/** ****************************************************************************** */ /** ****************************************************************************** */
/**
* @typedef {Promise<object>} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {(Object[]|string)} [payload=[]] - Payload
*/
/** /**
* ============================================================================== * ==============================================================================
* Main Function * Main Function
* ============================================================================== * ==============================================================================
* @param {String} key - API Key * @param {object} params - Single Param object containing params
* @param {String} database - Target Database * @param {String} params.key - API Key
* @param {Object} payload - SQL query String or Request Object. Eg. { * @param {String} params.database - Target Database
action: "insert | update | delete", * @param {(Object | string)} [params.payload={ action: "insert | update | delete", data: {}, table: "posts" }] SQL query String or Request
data: { * @param {Object} params.response - Http response object
user_id: user.id, * @param {String} params.encryptionKey - Encryption Key
user_first_name: user.first_name, * @param {String} params.encryptionSalt - Encryption Salt
user_last_name: user.last_name, *
}, * @returns {FunctionReturn}
table: "posts",
}
* @param {Object} response - Http response object
* @param {String} encryptionKey - Encryption Key
* @param {String} encryptionSalt - Encryption Salt
*/ */
module.exports = async function ({ key, payload, database, response, encryptionKey, encryptionSalt }) { module.exports = async function ({ key, payload, database, response, encryptionKey, encryptionSalt }) {
/** /**

View File

@ -2,7 +2,9 @@
* ============================================================================== * ==============================================================================
* Main Function * Main Function
* ============================================================================== * ==============================================================================
* @param {Object} response - Http response object * @param {object} params - Single Param object containing params
* @param {object} params.request - Http request object
* @param {object} params.response - Http response object
*/ */
module.exports = function ({ request, response }) { module.exports = function ({ request, response }) {
/** /**

View File

@ -12,20 +12,25 @@ const https = require("https");
/** ****************************************************************************** */ /** ****************************************************************************** */
/** ****************************************************************************** */ /** ****************************************************************************** */
/**
* @typedef {Promise<object>} FunctionReturn
* @property {boolean} success - Did the function run successfully?
* @property {(Object[]|string)} [payload=[]] - Payload
*/
/** /**
* ============================================================================== * ==============================================================================
* Main Function * Main Function
* ============================================================================== * ==============================================================================
* @param {String} key - API Key * @async
* @param {String} database - Target Database *
* @param {String | Object} payload - User Object. Eg. { * @param {object} params - API Key
id: 3, ****Required * @param {String} params.key - API Key
first_name: "Benjamin", * @param {String} params.database - Target Database
last_name:"Toby", * @param {String | Object} [params.payload={ id: 4, first_name: "Benjamin" }] - User Object.
email:"benoti.san@gmail.com", * @param {number} [params.payload.id] - User id => Required
username:"tben", *
password:"12345678", * @returns {FunctionReturn}
}
*/ */
module.exports = async function ({ key, payload, database }) { module.exports = async function ({ key, payload, database }) {
/** /**