diff --git a/package.json b/package.json index 21bed05..0f8ea32 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "datasquirel", - "version": "1.1.3", + "version": "1.1.4", "description": "Cloud-based SQL data management tool", "main": "index.js", "scripts": { diff --git a/users/add-user.js b/users/add-user.js index c6f9567..c0e8d3a 100644 --- a/users/add-user.js +++ b/users/add-user.js @@ -18,7 +18,7 @@ const https = require("https"); * ============================================================================== * @param {String} key - API Key * @param {String} database - Target Database - * @param {String | Object} payload - SQL query String or Request Object. Eg. { + * @param {String | Object} payload - User Object. Eg. { first_name: "Benjamin", last_name:"Toby", email:"benoti.san@gmail.com", diff --git a/users/update-user.js b/users/update-user.js index 2ecc1c1..e089199 100644 --- a/users/update-user.js +++ b/users/update-user.js @@ -18,7 +18,8 @@ const https = require("https"); * ============================================================================== * @param {String} key - API Key * @param {String} database - Target Database - * @param {String | Object} payload - SQL query String or Request Object. Eg. { + * @param {String | Object} payload - User Object. Eg. { + id: 3, ****Required first_name: "Benjamin", last_name:"Toby", email:"benoti.san@gmail.com", diff --git a/utils/post.js b/utils/post.js index fff280e..84dd2d4 100644 --- a/utils/post.js +++ b/utils/post.js @@ -17,7 +17,8 @@ const https = require("https"); * Main Function * ============================================================================== * @param {String} key - API Key - * @param {String | Object} payload - SQL query String or Request Object. Eg. { + * @param {String} database - Database Name + * @param {String | Object} query - SQL query String or Request Object. Eg. { action: "insert | update | delete", data: { user_id: user.id, @@ -25,16 +26,22 @@ const https = require("https"); user_last_name: user.last_name, }, table: "posts", + identifierColumnName: "id", + identifierValue: 1, + condition: "WHERE likes > 2" } */ -module.exports = async function ({ key, payload }) { +module.exports = async function ({ key, query, database }) { /** * Make https request * * @description make a request to datasquirel.com */ const httpResponse = await new Promise((resolve, reject) => { - const reqPayload = JSON.stringify(payload); + const reqPayload = JSON.stringify({ + query, + database, + }); const httpsRequest = https.request( {