42 lines
2.1 KiB
JavaScript
42 lines
2.1 KiB
JavaScript
"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),
|
|
};
|
|
});
|
|
}
|