This commit is contained in:
Benjamin Toby
2025-02-09 13:54:01 +01:00
parent 3358412028
commit 5e3476ad15
3 changed files with 11 additions and 15 deletions
+4 -7
View File
@@ -30,8 +30,8 @@ function dsqlMethodCrud(_a) {
let LIMIT = 10;
let PAGE = 1;
let OFFSET = (PAGE - 1) * LIMIT;
if (finalQuery) {
const newFinalQuery = lodash_1.default.cloneDeep(finalQuery);
if (method == "GET") {
const newFinalQuery = lodash_1.default.cloneDeep(finalQuery || {});
Object.keys(newFinalQuery).forEach((key) => {
const value = newFinalQuery[key];
if (typeof value == "string" && value.match(/^\{|^\[/)) {
@@ -51,9 +51,6 @@ function dsqlMethodCrud(_a) {
OFFSET = (PAGE - 1) * LIMIT;
finalQuery = newFinalQuery;
}
else {
finalQuery = {};
}
let finalData = finalBody
? Object.assign(Object.assign({}, finalBody), extraData)
: {};
@@ -76,7 +73,7 @@ function dsqlMethodCrud(_a) {
console.log("DEBUG:::transforming Query ...");
}
finalQuery = yield transformQuery({
query: finalQuery,
query: finalQuery || {},
user,
reqMethod: method,
});
@@ -90,7 +87,7 @@ function dsqlMethodCrud(_a) {
const GET_RESULT = yield (0, crud_1.default)({
action: "get",
table: tableName,
query: finalQuery && ((_b = Object.keys(finalQuery)) === null || _b === void 0 ? void 0 : _b[0])
query: finalQuery && Boolean((_b = Object.keys(finalQuery)) === null || _b === void 0 ? void 0 : _b[0])
? Object.assign(Object.assign({}, finalQuery), { query: Object.assign(Object.assign({}, finalQuery.query), ((user === null || user === void 0 ? void 0 : user.id) && addUser
? {
[addUser.field]: {