Update types

This commit is contained in:
Benjamin Toby
2024-10-21 08:05:18 +01:00
parent fabf2945d7
commit d774e8d35d
6 changed files with 100 additions and 59 deletions
+2 -19
View File
@@ -2,31 +2,16 @@
const runQuery = require("./utils/runQuery");
/**
* @typedef {Object} LocalPostReturn
* @property {boolean} success - Did the function run successfully?
* @property {*} [payload] - GET request results
* @property {string} [msg] - Message
* @property {string} [error] - Error Message
*/
/**
* @typedef {Object} LocalPostQueryObject
* @property {string | import("../../utils/post").PostDataPayload} query - Table Name
* @property {string} [tableName] - Table Name
* @property {string[]} [queryValues] - GET request results
*/
/**
* Make a get request to Datasquirel API
* ==============================================================================
* @async
*
* @param {Object} params - Single object passed
* @param {LocalPostQueryObject} params.options - SQL Query
* @param {import("../../package-shared/types").LocalPostQueryObject} params.options - SQL Query
* @param {import("../../package-shared/types").DSQL_DatabaseSchemaType | undefined} [params.dbSchema] - Name of the table to query
*
* @returns { Promise<LocalPostReturn> } - Return Object
* @returns { Promise<import("../../package-shared/types").LocalPostReturn> } - Return Object
*/
async function localPost({ options, dbSchema }) {
try {
@@ -83,7 +68,6 @@ async function localPost({ options, dbSchema }) {
return {
success: false,
payload: null,
error: error.message,
};
}
@@ -95,7 +79,6 @@ async function localPost({ options, dbSchema }) {
return {
success: false,
payload: null,
msg: "Something went wrong!",
};