This commit is contained in:
Benjamin Toby
2025-07-05 17:39:29 +01:00
parent ad904622eb
commit fcc668d3a1
19 changed files with 70 additions and 8 deletions
+5 -1
View File
@@ -11,12 +11,16 @@ type Params<T extends {
};
targetID?: string | number;
apiKey?: string;
/**
* # Query datasquirel.com
*/
useDefault?: boolean;
};
export default function apiCrudDELETE<T extends {
[key: string]: any;
} = {
[key: string]: any;
}>({ dbName, tableName, deleteSpec, targetID, apiKey }: Params<T>): Promise<import("../../types").APIResponseObject<{
}>({ dbName, tableName, deleteSpec, targetID, apiKey, useDefault }: Params<T>): Promise<import("../../types").APIResponseObject<{
[k: string]: any;
}>>;
export {};
+2 -1
View File
@@ -17,7 +17,7 @@ const path_1 = __importDefault(require("path"));
const query_dsql_api_1 = __importDefault(require("../../functions/api/query-dsql-api"));
const grab_api_base_path_1 = __importDefault(require("../../utils/grab-api-base-path"));
function apiCrudDELETE(_a) {
return __awaiter(this, arguments, void 0, function* ({ dbName, tableName, deleteSpec, targetID, apiKey }) {
return __awaiter(this, arguments, void 0, function* ({ dbName, tableName, deleteSpec, targetID, apiKey, useDefault }) {
const basePath = (0, grab_api_base_path_1.default)({ paradigm: "crud" });
const finalID = typeof targetID === "number" ? String(targetID) : targetID;
const finalPath = path_1.default.join(basePath, dbName, tableName, finalID || "");
@@ -26,6 +26,7 @@ function apiCrudDELETE(_a) {
path: finalPath,
body: deleteSpec,
apiKey,
useDefault,
});
return GET_RES;
});
+5 -1
View File
@@ -9,10 +9,14 @@ type Params<T extends {
query?: DsqlCrudQueryObject<T>;
targetId?: string | number;
apiKey?: string;
/**
* # Query datasquirel.com
*/
useDefault?: boolean;
};
export default function apiCrudGET<T extends {
[key: string]: any;
} = {
[key: string]: any;
}>({ dbName, tableName, query, targetId, apiKey, }: Params<T>): Promise<APIResponseObject>;
}>({ dbName, tableName, query, targetId, apiKey, useDefault, }: Params<T>): Promise<APIResponseObject>;
export {};
+2 -1
View File
@@ -17,7 +17,7 @@ const path_1 = __importDefault(require("path"));
const query_dsql_api_1 = __importDefault(require("../../functions/api/query-dsql-api"));
const grab_api_base_path_1 = __importDefault(require("../../utils/grab-api-base-path"));
function apiCrudGET(_a) {
return __awaiter(this, arguments, void 0, function* ({ dbName, tableName, query, targetId, apiKey, }) {
return __awaiter(this, arguments, void 0, function* ({ dbName, tableName, query, targetId, apiKey, useDefault, }) {
const basePath = (0, grab_api_base_path_1.default)({ paradigm: "crud" });
const finalID = typeof targetId === "number" ? String(targetId) : targetId;
const finalPath = path_1.default.join(basePath, dbName, tableName, finalID || "");
@@ -26,6 +26,7 @@ function apiCrudGET(_a) {
path: finalPath,
query,
apiKey,
useDefault,
});
return GET_RES;
});
+5 -1
View File
@@ -9,9 +9,13 @@ export type APICrudPostParams<T extends {
body: T;
update?: boolean;
apiKey?: string;
/**
* # Query datasquirel.com
*/
useDefault?: boolean;
};
export default function apiCrudPOST<T extends {
[key: string]: any;
} = {
[key: string]: any;
}>({ dbName, tableName, body, update, apiKey, }: APICrudPostParams<T>): Promise<APIResponseObject>;
}>({ dbName, tableName, body, update, apiKey, useDefault, }: APICrudPostParams<T>): Promise<APIResponseObject>;
+2 -1
View File
@@ -17,7 +17,7 @@ const path_1 = __importDefault(require("path"));
const query_dsql_api_1 = __importDefault(require("../../functions/api/query-dsql-api"));
const grab_api_base_path_1 = __importDefault(require("../../utils/grab-api-base-path"));
function apiCrudPOST(_a) {
return __awaiter(this, arguments, void 0, function* ({ dbName, tableName, body, update, apiKey, }) {
return __awaiter(this, arguments, void 0, function* ({ dbName, tableName, body, update, apiKey, useDefault, }) {
const basePath = (0, grab_api_base_path_1.default)({ paradigm: "crud" });
const passedID = body.id;
const finalID = update
@@ -31,6 +31,7 @@ function apiCrudPOST(_a) {
path: finalPath,
body,
apiKey,
useDefault,
});
return GET_RES;
});