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
* ==============================================================================
* @type {{
* createUser: Function
* loginUser: Function
* logoutUser: Function
* userAuth: Function
* updateUser: Function
* }}
*/
const user = {
createUser: createUser,
@ -43,9 +36,6 @@ const user = {
* ==============================================================================
* Media Functions Object
* ==============================================================================
* @type {{
* uploadImage: Function
* }}
*/
const media = {
uploadImage: uploadImage,
@ -55,21 +45,6 @@ const media = {
* ==============================================================================
* Main Export
* ==============================================================================
* @type {{
* get: Function,
* post: Function,
* media: {
* uploadImage: Function
* },
* user: {
* createUser: Function
* loginUser: Function
* logoutUser: Function
* userAuth: Function
* updateUser: Function
* },
* }}
* ==============================================================================
*/
const datasquirel = {
get: get,

View File

@ -1,6 +1,6 @@
{
"name": "datasquirel",
"version": "1.1.6",
"version": "1.1.7",
"description": "Cloud-based SQL data management tool",
"main": "index.js",
"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
* ==============================================================================
* @param {String} key - API Key
* @param {String} database - Target Database
* @param {String | Object} payload - User Object. Eg. {
first_name: "Benjamin",
last_name:"Toby",
email:"benoti.san@gmail.com",
username:"tben",
password:"12345678",
}
* @async
*
* @param {{
* key: string,
* payload: string,
* database: string
* }}
*
* @returns {FunctionReturn}
*/
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
* ==============================================================================
* @param {String} key - API Key
* @param {String} database - Target Database
* @param {Object} payload - SQL query String or Request Object. Eg. {
action: "insert | update | delete",
data: {
user_id: user.id,
user_first_name: user.first_name,
user_last_name: user.last_name,
},
table: "posts",
}
* @param {Object} response - Http response object
* @param {String} encryptionKey - Encryption Key
* @param {String} encryptionSalt - Encryption Salt
* @param {object} params - Single Param object containing params
* @param {String} params.key - API Key
* @param {String} params.database - Target Database
* @param {(Object | string)} [params.payload={ action: "insert | update | delete", data: {}, table: "posts" }] SQL query String or Request
* @param {Object} params.response - Http response object
* @param {String} params.encryptionKey - Encryption Key
* @param {String} params.encryptionSalt - Encryption Salt
*
* @returns {FunctionReturn}
*/
module.exports = async function ({ key, payload, database, response, encryptionKey, encryptionSalt }) {
/**

View File

@ -2,7 +2,9 @@
* ==============================================================================
* 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 }) {
/**

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
* ==============================================================================
* @param {String} key - API Key
* @param {String} database - Target Database
* @param {String | Object} payload - User Object. Eg. {
id: 3, ****Required
first_name: "Benjamin",
last_name:"Toby",
email:"benoti.san@gmail.com",
username:"tben",
password:"12345678",
}
* @async
*
* @param {object} params - API Key
* @param {String} params.key - API Key
* @param {String} params.database - Target Database
* @param {String | Object} [params.payload={ id: 4, first_name: "Benjamin" }] - User Object.
* @param {number} [params.payload.id] - User id => Required
*
* @returns {FunctionReturn}
*/
module.exports = async function ({ key, payload, database }) {
/**