This commit is contained in:
Benjamin Toby
2025-07-05 18:17:35 +01:00
parent fcc668d3a1
commit 3597b11342
8 changed files with 32 additions and 19 deletions
@@ -23,6 +23,7 @@ type Param<T extends { [k: string]: any } = any> = {
identifierColumnName: keyof T;
identifierValue: string | number;
forceLocal?: boolean;
debug?: boolean;
};
/**
@@ -42,6 +43,7 @@ export default async function updateDbEntry<
encryptionKey,
encryptionSalt,
forceLocal,
debug,
}: Param<T>): Promise<APIResponseObject<PostInsertReturn>> {
/**
* Check if data is valid
@@ -192,5 +194,6 @@ export default async function updateDbEntry<
sql: query,
params: updateValues,
},
debug: debug ? { data, newData } : undefined,
};
}
+4 -3
View File
@@ -1,11 +1,8 @@
import sqlDeleteGenerator from "../../functions/dsql/sql/sql-delete-generator";
import sqlGenerator from "../../functions/dsql/sql/sql-generator";
import {
APIResponseObject,
DsqlCrudParam,
DSQLErrorObject,
PostInsertReturn,
PostReturn,
} from "../../types";
import dsqlCrudGet from "./crud-get";
import connDbHandler from "../db/conn-db-handler";
@@ -28,7 +25,9 @@ export default async function dsqlCrud<
deleteData,
batchData,
deleteKeyValues,
debug,
} = params;
const finalData = (sanitize ? sanitize({ data }) : data) as T;
const finalBatchData = (
sanitize ? sanitize({ batchData }) : batchData
@@ -49,6 +48,7 @@ export default async function dsqlCrud<
batchData: finalBatchData,
tableName: table,
dbFullName,
debug,
});
return INSERT_RESULT;
@@ -61,6 +61,7 @@ export default async function dsqlCrud<
dbFullName,
identifierColumnName: (targetField || "id") as string,
identifierValue: String(targetValue || targetId),
debug,
});
return UPDATE_RESULT;
+8 -6
View File
@@ -10,11 +10,13 @@ export default function setupGlobalNetwork() {
execSync(`docker network rm ${globalNetworkName}`, {});
} catch (error) {}
let newNtwkCmd = `docker network create`;
newNtwkCmd += ` --driver bridge`;
newNtwkCmd += ` --subnet ${globalIPPrefix}.0/24`;
newNtwkCmd += ` --gateway ${globalIPPrefix}.1`;
newNtwkCmd += ` ${globalNetworkName}`;
try {
let newNtwkCmd = `docker network create`;
newNtwkCmd += ` --driver bridge`;
newNtwkCmd += ` --subnet ${globalIPPrefix}.0/24`;
newNtwkCmd += ` --gateway ${globalIPPrefix}.1`;
newNtwkCmd += ` ${globalNetworkName}`;
execSync(newNtwkCmd);
execSync(newNtwkCmd);
} catch (error) {}
}