@azteam/express 1.2.425 → 1.2.427
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Server.js +28 -34
- package/lib/SocketServer.js +1 -1
- package/lib/controller/AdminController.js +295 -337
- package/lib/middleware/cacheMiddleware.js +52 -54
- package/lib/middleware/etagMiddleware.js +21 -23
- package/lib/middleware/paginateMiddleware.js +85 -87
- package/lib/middleware/recaptchaMiddleware.js +28 -30
- package/lib/middleware/roleMiddleware.js +82 -84
- package/lib/middleware/signMiddleware.js +18 -20
- package/lib/middleware/validateMiddleware.js +8 -10
- package/lib/middleware/verifyGoogleAppMiddleware.js +14 -16
- package/package.json +1 -1
|
@@ -17,10 +17,10 @@ function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread n
|
|
|
17
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
18
18
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
19
19
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
20
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++)
|
|
20
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
21
21
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
22
22
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
23
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
23
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
24
24
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
25
25
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
26
26
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -50,21 +50,19 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
50
50
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, res) {
|
|
51
51
|
var data;
|
|
52
52
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
53
|
-
while (1) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
return _context.stop();
|
|
67
|
-
}
|
|
53
|
+
while (1) switch (_context.prev = _context.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
_context.next = 2;
|
|
56
|
+
return _this.repository.findAll(req.query, {
|
|
57
|
+
limit: 2000,
|
|
58
|
+
lean: true
|
|
59
|
+
});
|
|
60
|
+
case 2:
|
|
61
|
+
data = _context.sent;
|
|
62
|
+
return _context.abrupt("return", res.success(data, _this.guardResponse, _this.allowResponse));
|
|
63
|
+
case 4:
|
|
64
|
+
case "end":
|
|
65
|
+
return _context.stop();
|
|
68
66
|
}
|
|
69
67
|
}, _callee);
|
|
70
68
|
}));
|
|
@@ -76,20 +74,18 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
76
74
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(req, res) {
|
|
77
75
|
var paginateData;
|
|
78
76
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
79
|
-
while (1) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
return _context2.stop();
|
|
92
|
-
}
|
|
77
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
_context2.next = 2;
|
|
80
|
+
return _this.repository.find(req.query, _objectSpread(_objectSpread({}, req.paginate), {}, {
|
|
81
|
+
lean: true
|
|
82
|
+
}));
|
|
83
|
+
case 2:
|
|
84
|
+
paginateData = _context2.sent;
|
|
85
|
+
return _context2.abrupt("return", res.success(paginateData, _this.guardResponse, _this.allowResponse));
|
|
86
|
+
case 4:
|
|
87
|
+
case "end":
|
|
88
|
+
return _context2.stop();
|
|
93
89
|
}
|
|
94
90
|
}, _callee2);
|
|
95
91
|
}));
|
|
@@ -101,20 +97,18 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
101
97
|
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(req, res) {
|
|
102
98
|
var paginateData;
|
|
103
99
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
104
|
-
while (1) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
return _context3.stop();
|
|
117
|
-
}
|
|
100
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
_context3.next = 2;
|
|
103
|
+
return _this.repository.findTrash(req.query, _objectSpread(_objectSpread({}, req.paginate), {}, {
|
|
104
|
+
lean: true
|
|
105
|
+
}));
|
|
106
|
+
case 2:
|
|
107
|
+
paginateData = _context3.sent;
|
|
108
|
+
return _context3.abrupt("return", res.success(paginateData, _this.guardResponse, _this.allowResponse));
|
|
109
|
+
case 4:
|
|
110
|
+
case "end":
|
|
111
|
+
return _context3.stop();
|
|
118
112
|
}
|
|
119
113
|
}, _callee3);
|
|
120
114
|
}));
|
|
@@ -126,24 +120,22 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
126
120
|
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(req, res) {
|
|
127
121
|
var item;
|
|
128
122
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
129
|
-
while (1) {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return _context4.stop();
|
|
146
|
-
}
|
|
123
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
124
|
+
case 0:
|
|
125
|
+
_context4.next = 2;
|
|
126
|
+
return _this.repository.findOneById(req.params.id);
|
|
127
|
+
case 2:
|
|
128
|
+
item = _context4.sent;
|
|
129
|
+
if (item) {
|
|
130
|
+
_context4.next = 5;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
133
|
+
return _context4.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
134
|
+
case 5:
|
|
135
|
+
return _context4.abrupt("return", res.success(item, _this.guardResponse, _this.allowResponse));
|
|
136
|
+
case 6:
|
|
137
|
+
case "end":
|
|
138
|
+
return _context4.stop();
|
|
147
139
|
}
|
|
148
140
|
}, _callee4);
|
|
149
141
|
}));
|
|
@@ -155,24 +147,22 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
155
147
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(req, res) {
|
|
156
148
|
var item;
|
|
157
149
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
158
|
-
while (1) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
return _context5.stop();
|
|
175
|
-
}
|
|
150
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
151
|
+
case 0:
|
|
152
|
+
_context5.next = 2;
|
|
153
|
+
return _this.repository.findOneTrashById(req.params.id);
|
|
154
|
+
case 2:
|
|
155
|
+
item = _context5.sent;
|
|
156
|
+
if (item) {
|
|
157
|
+
_context5.next = 5;
|
|
158
|
+
break;
|
|
159
|
+
}
|
|
160
|
+
return _context5.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
161
|
+
case 5:
|
|
162
|
+
return _context5.abrupt("return", res.success(item, _this.guardResponse, _this.allowResponse));
|
|
163
|
+
case 6:
|
|
164
|
+
case "end":
|
|
165
|
+
return _context5.stop();
|
|
176
166
|
}
|
|
177
167
|
}, _callee5);
|
|
178
168
|
}));
|
|
@@ -183,14 +173,12 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
183
173
|
_defineProperty(_assertThisInitialized(_this), "methodPostCreate", /*#__PURE__*/function () {
|
|
184
174
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(data, user) {
|
|
185
175
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
186
|
-
while (1) {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return _context6.stop();
|
|
193
|
-
}
|
|
176
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
177
|
+
case 0:
|
|
178
|
+
return _context6.abrupt("return", _this.repository.createByUser(user.id, data));
|
|
179
|
+
case 1:
|
|
180
|
+
case "end":
|
|
181
|
+
return _context6.stop();
|
|
194
182
|
}
|
|
195
183
|
}, _callee6);
|
|
196
184
|
}));
|
|
@@ -201,14 +189,12 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
201
189
|
_defineProperty(_assertThisInitialized(_this), "methodPutModify", /*#__PURE__*/function () {
|
|
202
190
|
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(item, data, user) {
|
|
203
191
|
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
204
|
-
while (1) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
return _context7.stop();
|
|
211
|
-
}
|
|
192
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
193
|
+
case 0:
|
|
194
|
+
return _context7.abrupt("return", item.modify(data, user.id));
|
|
195
|
+
case 1:
|
|
196
|
+
case "end":
|
|
197
|
+
return _context7.stop();
|
|
212
198
|
}
|
|
213
199
|
}, _callee7);
|
|
214
200
|
}));
|
|
@@ -220,30 +206,28 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
220
206
|
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(req, res) {
|
|
221
207
|
var item;
|
|
222
208
|
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
223
|
-
while (1) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return _context8.stop();
|
|
246
|
-
}
|
|
209
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
210
|
+
case 0:
|
|
211
|
+
_context8.next = 2;
|
|
212
|
+
return _this.repository.findOneById(req.params.id);
|
|
213
|
+
case 2:
|
|
214
|
+
item = _context8.sent;
|
|
215
|
+
if (item) {
|
|
216
|
+
_context8.next = 5;
|
|
217
|
+
break;
|
|
218
|
+
}
|
|
219
|
+
return _context8.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
220
|
+
case 5:
|
|
221
|
+
_context8.next = 7;
|
|
222
|
+
return _this.repository["delete"](item, req.user.id);
|
|
223
|
+
case 7:
|
|
224
|
+
_context8.next = 9;
|
|
225
|
+
return _this.afterDelete(item);
|
|
226
|
+
case 9:
|
|
227
|
+
return _context8.abrupt("return", res.success(true));
|
|
228
|
+
case 10:
|
|
229
|
+
case "end":
|
|
230
|
+
return _context8.stop();
|
|
247
231
|
}
|
|
248
232
|
}, _callee8);
|
|
249
233
|
}));
|
|
@@ -255,27 +239,25 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
255
239
|
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(req, res) {
|
|
256
240
|
var item;
|
|
257
241
|
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
258
|
-
while (1) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return _context9.stop();
|
|
278
|
-
}
|
|
242
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
243
|
+
case 0:
|
|
244
|
+
_context9.next = 2;
|
|
245
|
+
return _this.repository.findOneTrashById(req.params.id);
|
|
246
|
+
case 2:
|
|
247
|
+
item = _context9.sent;
|
|
248
|
+
if (item) {
|
|
249
|
+
_context9.next = 5;
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
return _context9.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
253
|
+
case 5:
|
|
254
|
+
_context9.next = 7;
|
|
255
|
+
return _this.repository.restore(item, req.user.id);
|
|
256
|
+
case 7:
|
|
257
|
+
return _context9.abrupt("return", res.success(true));
|
|
258
|
+
case 8:
|
|
259
|
+
case "end":
|
|
260
|
+
return _context9.stop();
|
|
279
261
|
}
|
|
280
262
|
}, _callee9);
|
|
281
263
|
}));
|
|
@@ -287,31 +269,29 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
287
269
|
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(req, res) {
|
|
288
270
|
var item, oldItem;
|
|
289
271
|
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
290
|
-
while (1) {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
return _context10.stop();
|
|
314
|
-
}
|
|
272
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
273
|
+
case 0:
|
|
274
|
+
_context10.next = 2;
|
|
275
|
+
return _this.repository.findOneTrashById(req.params.id);
|
|
276
|
+
case 2:
|
|
277
|
+
item = _context10.sent;
|
|
278
|
+
if (item) {
|
|
279
|
+
_context10.next = 5;
|
|
280
|
+
break;
|
|
281
|
+
}
|
|
282
|
+
return _context10.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
283
|
+
case 5:
|
|
284
|
+
oldItem = _lodash["default"].cloneDeep(item);
|
|
285
|
+
_context10.next = 8;
|
|
286
|
+
return _this.repository.destroy(item.id);
|
|
287
|
+
case 8:
|
|
288
|
+
_context10.next = 10;
|
|
289
|
+
return _this.afterDestroy(oldItem);
|
|
290
|
+
case 10:
|
|
291
|
+
return _context10.abrupt("return", res.success(true));
|
|
292
|
+
case 11:
|
|
293
|
+
case "end":
|
|
294
|
+
return _context10.stop();
|
|
315
295
|
}
|
|
316
296
|
}, _callee10);
|
|
317
297
|
}));
|
|
@@ -400,14 +380,12 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
400
380
|
value: function () {
|
|
401
381
|
var _beforeCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(data) {
|
|
402
382
|
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
403
|
-
while (1) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
return _context11.stop();
|
|
410
|
-
}
|
|
383
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
384
|
+
case 0:
|
|
385
|
+
return _context11.abrupt("return", data);
|
|
386
|
+
case 1:
|
|
387
|
+
case "end":
|
|
388
|
+
return _context11.stop();
|
|
411
389
|
}
|
|
412
390
|
}, _callee11);
|
|
413
391
|
}));
|
|
@@ -421,14 +399,12 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
421
399
|
value: function () {
|
|
422
400
|
var _afterCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(item) {
|
|
423
401
|
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
424
|
-
while (1) {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
return _context12.stop();
|
|
431
|
-
}
|
|
402
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
403
|
+
case 0:
|
|
404
|
+
return _context12.abrupt("return", item);
|
|
405
|
+
case 1:
|
|
406
|
+
case "end":
|
|
407
|
+
return _context12.stop();
|
|
432
408
|
}
|
|
433
409
|
}, _callee12);
|
|
434
410
|
}));
|
|
@@ -448,26 +424,24 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
448
424
|
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(req, res) {
|
|
449
425
|
var data, item;
|
|
450
426
|
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
451
|
-
while (1) {
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
return _context13.stop();
|
|
470
|
-
}
|
|
427
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
428
|
+
case 0:
|
|
429
|
+
_context13.next = 2;
|
|
430
|
+
return _this2.beforeCreate(req.body);
|
|
431
|
+
case 2:
|
|
432
|
+
data = _context13.sent;
|
|
433
|
+
_context13.next = 5;
|
|
434
|
+
return _this2.methodPostCreate(data, req.user);
|
|
435
|
+
case 5:
|
|
436
|
+
item = _context13.sent;
|
|
437
|
+
_context13.next = 8;
|
|
438
|
+
return _this2.afterCreate(item);
|
|
439
|
+
case 8:
|
|
440
|
+
item = _context13.sent;
|
|
441
|
+
return _context13.abrupt("return", res.success(item, _this2.guardResponse, _this2.allowResponse));
|
|
442
|
+
case 10:
|
|
443
|
+
case "end":
|
|
444
|
+
return _context13.stop();
|
|
471
445
|
}
|
|
472
446
|
}, _callee13);
|
|
473
447
|
}));
|
|
@@ -482,14 +456,12 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
482
456
|
value: function () {
|
|
483
457
|
var _beforeModify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(data) {
|
|
484
458
|
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
485
|
-
while (1) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return _context14.stop();
|
|
492
|
-
}
|
|
459
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
460
|
+
case 0:
|
|
461
|
+
return _context14.abrupt("return", data);
|
|
462
|
+
case 1:
|
|
463
|
+
case "end":
|
|
464
|
+
return _context14.stop();
|
|
493
465
|
}
|
|
494
466
|
}, _callee14);
|
|
495
467
|
}));
|
|
@@ -503,14 +475,12 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
503
475
|
value: function () {
|
|
504
476
|
var _afterModify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(item) {
|
|
505
477
|
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
506
|
-
while (1) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
return _context15.stop();
|
|
513
|
-
}
|
|
478
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
479
|
+
case 0:
|
|
480
|
+
return _context15.abrupt("return", item);
|
|
481
|
+
case 1:
|
|
482
|
+
case "end":
|
|
483
|
+
return _context15.stop();
|
|
514
484
|
}
|
|
515
485
|
}, _callee15);
|
|
516
486
|
}));
|
|
@@ -530,33 +500,31 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
530
500
|
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(req, res) {
|
|
531
501
|
var item, data;
|
|
532
502
|
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
533
|
-
while (1) {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
return _context16.stop();
|
|
559
|
-
}
|
|
503
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
504
|
+
case 0:
|
|
505
|
+
_context16.next = 2;
|
|
506
|
+
return _this3.repository.findOneById(req.params.id);
|
|
507
|
+
case 2:
|
|
508
|
+
item = _context16.sent;
|
|
509
|
+
if (item) {
|
|
510
|
+
_context16.next = 5;
|
|
511
|
+
break;
|
|
512
|
+
}
|
|
513
|
+
return _context16.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
514
|
+
case 5:
|
|
515
|
+
_context16.next = 7;
|
|
516
|
+
return _this3.beforeModify(req.body);
|
|
517
|
+
case 7:
|
|
518
|
+
data = _context16.sent;
|
|
519
|
+
item = _this3.methodPutModify(item, data, req.user);
|
|
520
|
+
_context16.next = 11;
|
|
521
|
+
return _this3.afterModify(item);
|
|
522
|
+
case 11:
|
|
523
|
+
item = _context16.sent;
|
|
524
|
+
return _context16.abrupt("return", res.success(item, _this3.guardResponse, _this3.allowResponse));
|
|
525
|
+
case 13:
|
|
526
|
+
case "end":
|
|
527
|
+
return _context16.stop();
|
|
560
528
|
}
|
|
561
529
|
}, _callee16);
|
|
562
530
|
}));
|
|
@@ -577,31 +545,29 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
577
545
|
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(req, res) {
|
|
578
546
|
var item;
|
|
579
547
|
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
580
|
-
while (1) {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
return _context17.stop();
|
|
604
|
-
}
|
|
548
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
549
|
+
case 0:
|
|
550
|
+
_context17.next = 2;
|
|
551
|
+
return _this4.repository.findOneById(req.params.id);
|
|
552
|
+
case 2:
|
|
553
|
+
item = _context17.sent;
|
|
554
|
+
if (item) {
|
|
555
|
+
_context17.next = 5;
|
|
556
|
+
break;
|
|
557
|
+
}
|
|
558
|
+
return _context17.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
559
|
+
case 5:
|
|
560
|
+
_context17.next = 7;
|
|
561
|
+
return item.modifyStatusAvailable(req.user.id);
|
|
562
|
+
case 7:
|
|
563
|
+
_context17.next = 9;
|
|
564
|
+
return _this4.afterModify(item);
|
|
565
|
+
case 9:
|
|
566
|
+
item = _context17.sent;
|
|
567
|
+
return _context17.abrupt("return", res.success(item, _this4.guardResponse, _this4.allowResponse));
|
|
568
|
+
case 11:
|
|
569
|
+
case "end":
|
|
570
|
+
return _context17.stop();
|
|
605
571
|
}
|
|
606
572
|
}, _callee17);
|
|
607
573
|
}));
|
|
@@ -622,31 +588,29 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
622
588
|
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(req, res) {
|
|
623
589
|
var item;
|
|
624
590
|
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
625
|
-
while (1) {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
return _context18.stop();
|
|
649
|
-
}
|
|
591
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
592
|
+
case 0:
|
|
593
|
+
_context18.next = 2;
|
|
594
|
+
return _this5.repository.findOneById(req.params.id);
|
|
595
|
+
case 2:
|
|
596
|
+
item = _context18.sent;
|
|
597
|
+
if (item) {
|
|
598
|
+
_context18.next = 5;
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
return _context18.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
602
|
+
case 5:
|
|
603
|
+
_context18.next = 7;
|
|
604
|
+
return item.modifyStatusUnavailable(req.body.message, req.user.id);
|
|
605
|
+
case 7:
|
|
606
|
+
_context18.next = 9;
|
|
607
|
+
return _this5.afterModify(item);
|
|
608
|
+
case 9:
|
|
609
|
+
item = _context18.sent;
|
|
610
|
+
return _context18.abrupt("return", res.success(item, _this5.guardResponse, _this5.allowResponse));
|
|
611
|
+
case 11:
|
|
612
|
+
case "end":
|
|
613
|
+
return _context18.stop();
|
|
650
614
|
}
|
|
651
615
|
}, _callee18);
|
|
652
616
|
}));
|
|
@@ -667,31 +631,29 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
667
631
|
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(req, res) {
|
|
668
632
|
var item;
|
|
669
633
|
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
670
|
-
while (1) {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
return _context19.stop();
|
|
694
|
-
}
|
|
634
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
635
|
+
case 0:
|
|
636
|
+
_context19.next = 2;
|
|
637
|
+
return _this6.repository.findOneById(req.params.id);
|
|
638
|
+
case 2:
|
|
639
|
+
item = _context19.sent;
|
|
640
|
+
if (item) {
|
|
641
|
+
_context19.next = 5;
|
|
642
|
+
break;
|
|
643
|
+
}
|
|
644
|
+
return _context19.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
645
|
+
case 5:
|
|
646
|
+
_context19.next = 7;
|
|
647
|
+
return item.modifyStatusWaiting(req.user.id);
|
|
648
|
+
case 7:
|
|
649
|
+
_context19.next = 9;
|
|
650
|
+
return _this6.afterModify(item);
|
|
651
|
+
case 9:
|
|
652
|
+
item = _context19.sent;
|
|
653
|
+
return _context19.abrupt("return", res.success(item, _this6.guardResponse, _this6.allowResponse));
|
|
654
|
+
case 11:
|
|
655
|
+
case "end":
|
|
656
|
+
return _context19.stop();
|
|
695
657
|
}
|
|
696
658
|
}, _callee19);
|
|
697
659
|
}));
|
|
@@ -706,14 +668,12 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
706
668
|
value: function () {
|
|
707
669
|
var _afterDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(item) {
|
|
708
670
|
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
709
|
-
while (1) {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
return _context20.stop();
|
|
716
|
-
}
|
|
671
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
672
|
+
case 0:
|
|
673
|
+
return _context20.abrupt("return", item);
|
|
674
|
+
case 1:
|
|
675
|
+
case "end":
|
|
676
|
+
return _context20.stop();
|
|
717
677
|
}
|
|
718
678
|
}, _callee20);
|
|
719
679
|
}));
|
|
@@ -745,14 +705,12 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
745
705
|
value: function () {
|
|
746
706
|
var _afterDestroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(item) {
|
|
747
707
|
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
748
|
-
while (1) {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
return _context21.stop();
|
|
755
|
-
}
|
|
708
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
709
|
+
case 0:
|
|
710
|
+
return _context21.abrupt("return", item);
|
|
711
|
+
case 1:
|
|
712
|
+
case "end":
|
|
713
|
+
return _context21.stop();
|
|
756
714
|
}
|
|
757
715
|
}, _callee21);
|
|
758
716
|
}));
|