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
+6 -1
View File
@@ -9,11 +9,15 @@ type Params<T extends { [key: string]: any } = { [key: string]: any }> = {
deleteSpec?: T & { deleteKeyValues?: SQLDeleteData<T>[] };
targetID?: string | number;
apiKey?: string;
/**
* # Query datasquirel.com
*/
useDefault?: boolean;
};
export default async function apiCrudDELETE<
T extends { [key: string]: any } = { [key: string]: any }
>({ dbName, tableName, deleteSpec, targetID, apiKey }: Params<T>) {
>({ dbName, tableName, deleteSpec, targetID, apiKey, useDefault }: Params<T>) {
const basePath = grabAPIBasePath({ paradigm: "crud" });
const finalID = typeof targetID === "number" ? String(targetID) : targetID;
@@ -25,6 +29,7 @@ export default async function apiCrudDELETE<
path: finalPath,
body: deleteSpec,
apiKey,
useDefault,
});
return GET_RES;
+6
View File
@@ -9,6 +9,10 @@ type Params<T extends { [key: string]: any } = { [key: string]: any }> = {
query?: DsqlCrudQueryObject<T>;
targetId?: string | number;
apiKey?: string;
/**
* # Query datasquirel.com
*/
useDefault?: boolean;
};
export default async function apiCrudGET<
@@ -19,6 +23,7 @@ export default async function apiCrudGET<
query,
targetId,
apiKey,
useDefault,
}: Params<T>): Promise<APIResponseObject> {
const basePath = grabAPIBasePath({ paradigm: "crud" });
@@ -31,6 +36,7 @@ export default async function apiCrudGET<
path: finalPath,
query,
apiKey,
useDefault,
});
return GET_RES;
+6
View File
@@ -11,6 +11,10 @@ export type APICrudPostParams<
body: T;
update?: boolean;
apiKey?: string;
/**
* # Query datasquirel.com
*/
useDefault?: boolean;
};
export default async function apiCrudPOST<
@@ -21,6 +25,7 @@ export default async function apiCrudPOST<
body,
update,
apiKey,
useDefault,
}: APICrudPostParams<T>): Promise<APIResponseObject> {
const basePath = grabAPIBasePath({ paradigm: "crud" });
@@ -39,6 +44,7 @@ export default async function apiCrudPOST<
path: finalPath,
body,
apiKey,
useDefault,
});
return GET_RES;