Roll Back compile version
This commit is contained in:
@@ -1,24 +1,41 @@
|
||||
import dsqlCrud from "../../../../utils/data-fetching/crud";
|
||||
import query from "./query";
|
||||
import _n from "../../../../utils/numberfy";
|
||||
export default async function dbGrabUserResource(params) {
|
||||
let queryObject = query(params);
|
||||
let result = await dsqlCrud({
|
||||
action: "get",
|
||||
table: params.tableName,
|
||||
query: queryObject,
|
||||
count: params.count,
|
||||
countOnly: params.countOnly,
|
||||
"use strict";
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = dbGrabUserResource;
|
||||
const crud_1 = __importDefault(require("../../../../utils/data-fetching/crud"));
|
||||
const query_1 = __importDefault(require("./query"));
|
||||
const numberfy_1 = __importDefault(require("../../../../utils/numberfy"));
|
||||
function dbGrabUserResource(params) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let queryObject = (0, query_1.default)(params);
|
||||
let result = yield (0, crud_1.default)({
|
||||
action: "get",
|
||||
table: params.tableName,
|
||||
query: queryObject,
|
||||
count: params.count,
|
||||
countOnly: params.countOnly,
|
||||
});
|
||||
const payload = result === null || result === void 0 ? void 0 : result.payload;
|
||||
return {
|
||||
batch: payload || null,
|
||||
single: (payload === null || payload === void 0 ? void 0 : payload[0]) || null,
|
||||
debug: {
|
||||
queryObject: result === null || result === void 0 ? void 0 : result.queryObject,
|
||||
error: result === null || result === void 0 ? void 0 : result.error,
|
||||
msg: result === null || result === void 0 ? void 0 : result.msg,
|
||||
},
|
||||
count: (0, numberfy_1.default)(result === null || result === void 0 ? void 0 : result.count),
|
||||
};
|
||||
});
|
||||
const payload = result === null || result === void 0 ? void 0 : result.payload;
|
||||
return {
|
||||
batch: payload || null,
|
||||
single: (payload === null || payload === void 0 ? void 0 : payload[0]) || null,
|
||||
debug: {
|
||||
queryObject: result === null || result === void 0 ? void 0 : result.queryObject,
|
||||
error: result === null || result === void 0 ? void 0 : result.error,
|
||||
msg: result === null || result === void 0 ? void 0 : result.msg,
|
||||
},
|
||||
count: _n(result === null || result === void 0 ? void 0 : result.count),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import _ from "lodash";
|
||||
import ResourceLimits from "../../../../dict/resource-limits";
|
||||
import _n from "../../../../utils/numberfy";
|
||||
export default function (params) {
|
||||
"use strict";
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = default_1;
|
||||
const lodash_1 = __importDefault(require("lodash"));
|
||||
const resource_limits_1 = __importDefault(require("../../../../dict/resource-limits"));
|
||||
const numberfy_1 = __importDefault(require("../../../../utils/numberfy"));
|
||||
function default_1(params) {
|
||||
let queryObject = {
|
||||
limit: (params === null || params === void 0 ? void 0 : params.noLimit) ? undefined : ResourceLimits["general"],
|
||||
limit: (params === null || params === void 0 ? void 0 : params.noLimit) ? undefined : resource_limits_1.default["general"],
|
||||
order: {
|
||||
field: "id",
|
||||
strategy: "DESC",
|
||||
@@ -13,11 +19,11 @@ export default function (params) {
|
||||
const targetIDQuery = {
|
||||
query: {
|
||||
id: {
|
||||
value: _n(params.targetID).toString(),
|
||||
value: (0, numberfy_1.default)(params.targetID).toString(),
|
||||
},
|
||||
},
|
||||
};
|
||||
queryObject = _.merge(queryObject, targetIDQuery);
|
||||
queryObject = lodash_1.default.merge(queryObject, targetIDQuery);
|
||||
}
|
||||
let queryFixedObject = (params === null || params === void 0 ? void 0 : params.isSuperUser)
|
||||
? {}
|
||||
@@ -28,5 +34,5 @@ export default function (params) {
|
||||
},
|
||||
},
|
||||
};
|
||||
return _.merge(queryObject, params === null || params === void 0 ? void 0 : params.query, queryFixedObject);
|
||||
return lodash_1.default.merge(queryObject, params === null || params === void 0 ? void 0 : params.query, queryFixedObject);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user