This commit is contained in:
2025-12-13 16:33:58 +01:00
parent c88fb13375
commit 14ea760373
4 changed files with 69 additions and 8 deletions
+1 -1
View File
@@ -3,4 +3,4 @@ export default function <T extends {
[key: string]: any;
} = {
[key: string]: any;
}, K extends string = string>({ table, query, count, countOnly, dbFullName, tableSchema, dbConfig, }: Omit<DsqlCrudParam<T, K>, "action" | "data" | "sanitize">): Promise<APIResponseObject>;
}, K extends string = string>({ table, query, count, countOnly, dbFullName, tableSchema, dbConfig, targetId, targetField, targetValue, }: Omit<DsqlCrudParam<T, K>, "action" | "data" | "sanitize">): Promise<APIResponseObject>;
+24 -3
View File
@@ -18,13 +18,34 @@ const sql_generator_1 = __importDefault(require("../../functions/dsql/sql/sql-ge
const conn_db_handler_1 = __importDefault(require("../db/conn-db-handler"));
const check_array_depth_1 = __importDefault(require("../check-array-depth"));
const parseDbResults_1 = __importDefault(require("../../functions/backend/parseDbResults"));
const lodash_1 = __importDefault(require("lodash"));
function default_1(_a) {
return __awaiter(this, arguments, void 0, function* ({ table, query, count, countOnly, dbFullName, tableSchema, dbConfig, }) {
return __awaiter(this, arguments, void 0, function* ({ table, query, count, countOnly, dbFullName, tableSchema, dbConfig, targetId, targetField, targetValue, }) {
var _b, _c, _d, _e;
let queryObject;
let crudQueryObj = lodash_1.default.cloneDeep(query);
if (targetId) {
crudQueryObj = lodash_1.default.merge(crudQueryObj || {}, {
query: {
id: {
value: String(targetId),
},
},
});
}
if (targetField &&
(typeof targetValue == "string" || typeof targetValue == "number")) {
crudQueryObj = lodash_1.default.merge(crudQueryObj || {}, {
query: {
[targetField]: {
value: String(targetValue),
},
},
});
}
queryObject = (0, sql_generator_1.default)({
tableName: table,
genObject: query,
genObject: crudQueryObj,
dbFullName,
});
let connQueries = [
@@ -36,7 +57,7 @@ function default_1(_a) {
const countQueryObject = count || countOnly
? (0, sql_generator_1.default)({
tableName: table,
genObject: query,
genObject: crudQueryObj,
count: true,
dbFullName,
})