This commit is contained in:
Tben 2023-08-10 16:01:16 +01:00
parent af6ebfe15c
commit 5f9f1ceeba
3 changed files with 117 additions and 87 deletions

View File

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

View File

@ -18,6 +18,7 @@ const https = require("https");
* @property {{ * @property {{
* urlPath: string, * urlPath: string,
* }} payload - Payload containing the url for the image and its thumbnail * }} payload - Payload containing the url for the image and its thumbnail
* @property {string} [msg] - An optional message
*/ */
/** /**
@ -39,6 +40,7 @@ const https = require("https");
* @returns { Promise<FunctionReturn> } - Return Object * @returns { Promise<FunctionReturn> } - Return Object
*/ */
async function uploadImage({ key, payload }) { async function uploadImage({ key, payload }) {
try {
/** /**
* Make https request * Make https request
* *
@ -91,6 +93,19 @@ async function uploadImage({ key, payload }) {
/** ********************************************** */ /** ********************************************** */
return httpResponse; return httpResponse;
} catch (error) {
/** ********************************************** */
/** ********************************************** */
/** ********************************************** */
console.log("Error in uploading file: ", error.message);
return {
success: false,
payload: null,
msg: error.message,
};
}
} }
/** ********************************************** */ /** ********************************************** */

View File

@ -19,6 +19,7 @@ const https = require("https");
* urlPath: string, * urlPath: string,
* urlThumbnailPath: string * urlThumbnailPath: string
* }} payload - Payload containing the url for the image and its thumbnail * }} payload - Payload containing the url for the image and its thumbnail
* @property {string} [msg] - An optional message
*/ */
/** /**
@ -41,6 +42,7 @@ const https = require("https");
* @returns { Promise<FunctionReturn> } - Return Object * @returns { Promise<FunctionReturn> } - Return Object
*/ */
async function uploadImage({ key, payload }) { async function uploadImage({ key, payload }) {
try {
/** /**
* Make https request * Make https request
* *
@ -93,6 +95,19 @@ async function uploadImage({ key, payload }) {
/** ********************************************** */ /** ********************************************** */
return httpResponse; return httpResponse;
} catch (error) {
/** ********************************************** */
/** ********************************************** */
/** ********************************************** */
console.log("Error in uploading image: ", error.message);
return {
success: false,
payload: null,
msg: error.message,
};
}
} }
/** ********************************************** */ /** ********************************************** */