@azteam/express 1.2.426 → 1.2.429
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 +374 -391
- 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
- package/src/controller/AdminController.js +13 -0
|
@@ -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
|
}));
|
|
@@ -351,6 +331,31 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
351
331
|
return _this;
|
|
352
332
|
}
|
|
353
333
|
_createClass(AdminController, [{
|
|
334
|
+
key: "getFilterOption",
|
|
335
|
+
value: function getFilterOption() {
|
|
336
|
+
var _this2 = this;
|
|
337
|
+
return {
|
|
338
|
+
disabled: !this.roles.READ,
|
|
339
|
+
path: '/filter_option',
|
|
340
|
+
method: [(0, _middleware.adminRoleMiddleware)([this.roles.READ], this.roleMiddlewareOptions), /*#__PURE__*/function () {
|
|
341
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(req, res) {
|
|
342
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
343
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
344
|
+
case 0:
|
|
345
|
+
return _context11.abrupt("return", res.success(_this2.paginateOptions));
|
|
346
|
+
case 1:
|
|
347
|
+
case "end":
|
|
348
|
+
return _context11.stop();
|
|
349
|
+
}
|
|
350
|
+
}, _callee11);
|
|
351
|
+
}));
|
|
352
|
+
return function (_x22, _x23) {
|
|
353
|
+
return _ref11.apply(this, arguments);
|
|
354
|
+
};
|
|
355
|
+
}()]
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
}, {
|
|
354
359
|
key: "getAll",
|
|
355
360
|
value: function getAll() {
|
|
356
361
|
return {
|
|
@@ -398,20 +403,18 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
398
403
|
}, {
|
|
399
404
|
key: "beforeCreate",
|
|
400
405
|
value: function () {
|
|
401
|
-
var _beforeCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
402
|
-
return _regeneratorRuntime().wrap(function
|
|
403
|
-
while (1) {
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
return _context11.stop();
|
|
410
|
-
}
|
|
406
|
+
var _beforeCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(data) {
|
|
407
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
408
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
409
|
+
case 0:
|
|
410
|
+
return _context12.abrupt("return", data);
|
|
411
|
+
case 1:
|
|
412
|
+
case "end":
|
|
413
|
+
return _context12.stop();
|
|
411
414
|
}
|
|
412
|
-
},
|
|
415
|
+
}, _callee12);
|
|
413
416
|
}));
|
|
414
|
-
function beforeCreate(
|
|
417
|
+
function beforeCreate(_x24) {
|
|
415
418
|
return _beforeCreate.apply(this, arguments);
|
|
416
419
|
}
|
|
417
420
|
return beforeCreate;
|
|
@@ -419,20 +422,18 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
419
422
|
}, {
|
|
420
423
|
key: "afterCreate",
|
|
421
424
|
value: function () {
|
|
422
|
-
var _afterCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
423
|
-
return _regeneratorRuntime().wrap(function
|
|
424
|
-
while (1) {
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
return _context12.stop();
|
|
431
|
-
}
|
|
425
|
+
var _afterCreate = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(item) {
|
|
426
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
427
|
+
while (1) switch (_context13.prev = _context13.next) {
|
|
428
|
+
case 0:
|
|
429
|
+
return _context13.abrupt("return", item);
|
|
430
|
+
case 1:
|
|
431
|
+
case "end":
|
|
432
|
+
return _context13.stop();
|
|
432
433
|
}
|
|
433
|
-
},
|
|
434
|
+
}, _callee13);
|
|
434
435
|
}));
|
|
435
|
-
function afterCreate(
|
|
436
|
+
function afterCreate(_x25) {
|
|
436
437
|
return _afterCreate.apply(this, arguments);
|
|
437
438
|
}
|
|
438
439
|
return afterCreate;
|
|
@@ -440,39 +441,37 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
440
441
|
}, {
|
|
441
442
|
key: "postCreate",
|
|
442
443
|
value: function postCreate() {
|
|
443
|
-
var
|
|
444
|
+
var _this3 = this;
|
|
444
445
|
return {
|
|
445
446
|
disabled: !this.roles.CREATE,
|
|
446
447
|
path: '/',
|
|
447
448
|
method: [(0, _middleware.adminRoleMiddleware)([this.roles.CREATE], this.roleMiddlewareOptions), /*#__PURE__*/function () {
|
|
448
|
-
var
|
|
449
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(req, res) {
|
|
449
450
|
var data, item;
|
|
450
|
-
return _regeneratorRuntime().wrap(function
|
|
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
|
-
}
|
|
451
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
452
|
+
while (1) switch (_context14.prev = _context14.next) {
|
|
453
|
+
case 0:
|
|
454
|
+
_context14.next = 2;
|
|
455
|
+
return _this3.beforeCreate(req.body);
|
|
456
|
+
case 2:
|
|
457
|
+
data = _context14.sent;
|
|
458
|
+
_context14.next = 5;
|
|
459
|
+
return _this3.methodPostCreate(data, req.user);
|
|
460
|
+
case 5:
|
|
461
|
+
item = _context14.sent;
|
|
462
|
+
_context14.next = 8;
|
|
463
|
+
return _this3.afterCreate(item);
|
|
464
|
+
case 8:
|
|
465
|
+
item = _context14.sent;
|
|
466
|
+
return _context14.abrupt("return", res.success(item, _this3.guardResponse, _this3.allowResponse));
|
|
467
|
+
case 10:
|
|
468
|
+
case "end":
|
|
469
|
+
return _context14.stop();
|
|
471
470
|
}
|
|
472
|
-
},
|
|
471
|
+
}, _callee14);
|
|
473
472
|
}));
|
|
474
|
-
return function (
|
|
475
|
-
return
|
|
473
|
+
return function (_x26, _x27) {
|
|
474
|
+
return _ref12.apply(this, arguments);
|
|
476
475
|
};
|
|
477
476
|
}()]
|
|
478
477
|
};
|
|
@@ -480,20 +479,18 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
480
479
|
}, {
|
|
481
480
|
key: "beforeModify",
|
|
482
481
|
value: function () {
|
|
483
|
-
var _beforeModify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
484
|
-
return _regeneratorRuntime().wrap(function
|
|
485
|
-
while (1) {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
return _context14.stop();
|
|
492
|
-
}
|
|
482
|
+
var _beforeModify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(data) {
|
|
483
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
484
|
+
while (1) switch (_context15.prev = _context15.next) {
|
|
485
|
+
case 0:
|
|
486
|
+
return _context15.abrupt("return", data);
|
|
487
|
+
case 1:
|
|
488
|
+
case "end":
|
|
489
|
+
return _context15.stop();
|
|
493
490
|
}
|
|
494
|
-
},
|
|
491
|
+
}, _callee15);
|
|
495
492
|
}));
|
|
496
|
-
function beforeModify(
|
|
493
|
+
function beforeModify(_x28) {
|
|
497
494
|
return _beforeModify.apply(this, arguments);
|
|
498
495
|
}
|
|
499
496
|
return beforeModify;
|
|
@@ -501,20 +498,18 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
501
498
|
}, {
|
|
502
499
|
key: "afterModify",
|
|
503
500
|
value: function () {
|
|
504
|
-
var _afterModify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
505
|
-
return _regeneratorRuntime().wrap(function
|
|
506
|
-
while (1) {
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
return _context15.stop();
|
|
513
|
-
}
|
|
501
|
+
var _afterModify = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(item) {
|
|
502
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
503
|
+
while (1) switch (_context16.prev = _context16.next) {
|
|
504
|
+
case 0:
|
|
505
|
+
return _context16.abrupt("return", item);
|
|
506
|
+
case 1:
|
|
507
|
+
case "end":
|
|
508
|
+
return _context16.stop();
|
|
514
509
|
}
|
|
515
|
-
},
|
|
510
|
+
}, _callee16);
|
|
516
511
|
}));
|
|
517
|
-
function afterModify(
|
|
512
|
+
function afterModify(_x29) {
|
|
518
513
|
return _afterModify.apply(this, arguments);
|
|
519
514
|
}
|
|
520
515
|
return afterModify;
|
|
@@ -522,46 +517,44 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
522
517
|
}, {
|
|
523
518
|
key: "putModify",
|
|
524
519
|
value: function putModify() {
|
|
525
|
-
var
|
|
520
|
+
var _this4 = this;
|
|
526
521
|
return {
|
|
527
522
|
disabled: !this.roles.UPDATE,
|
|
528
523
|
path: '/:id([a-zA-Z0-9]+)',
|
|
529
524
|
method: [(0, _middleware.adminRoleMiddleware)([this.roles.UPDATE], this.roleMiddlewareOptions), (0, _middleware.validateMiddleware)(_constant.REQUEST_TYPE.PARAMS, _validator.rulesId), /*#__PURE__*/function () {
|
|
530
|
-
var
|
|
525
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee17(req, res) {
|
|
531
526
|
var item, data;
|
|
532
|
-
return _regeneratorRuntime().wrap(function
|
|
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
|
-
}
|
|
527
|
+
return _regeneratorRuntime().wrap(function _callee17$(_context17) {
|
|
528
|
+
while (1) switch (_context17.prev = _context17.next) {
|
|
529
|
+
case 0:
|
|
530
|
+
_context17.next = 2;
|
|
531
|
+
return _this4.repository.findOneById(req.params.id);
|
|
532
|
+
case 2:
|
|
533
|
+
item = _context17.sent;
|
|
534
|
+
if (item) {
|
|
535
|
+
_context17.next = 5;
|
|
536
|
+
break;
|
|
537
|
+
}
|
|
538
|
+
return _context17.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
539
|
+
case 5:
|
|
540
|
+
_context17.next = 7;
|
|
541
|
+
return _this4.beforeModify(req.body);
|
|
542
|
+
case 7:
|
|
543
|
+
data = _context17.sent;
|
|
544
|
+
item = _this4.methodPutModify(item, data, req.user);
|
|
545
|
+
_context17.next = 11;
|
|
546
|
+
return _this4.afterModify(item);
|
|
547
|
+
case 11:
|
|
548
|
+
item = _context17.sent;
|
|
549
|
+
return _context17.abrupt("return", res.success(item, _this4.guardResponse, _this4.allowResponse));
|
|
550
|
+
case 13:
|
|
551
|
+
case "end":
|
|
552
|
+
return _context17.stop();
|
|
560
553
|
}
|
|
561
|
-
},
|
|
554
|
+
}, _callee17);
|
|
562
555
|
}));
|
|
563
|
-
return function (
|
|
564
|
-
return
|
|
556
|
+
return function (_x30, _x31) {
|
|
557
|
+
return _ref13.apply(this, arguments);
|
|
565
558
|
};
|
|
566
559
|
}()]
|
|
567
560
|
};
|
|
@@ -569,44 +562,42 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
569
562
|
}, {
|
|
570
563
|
key: "putModifyStatusAvailable",
|
|
571
564
|
value: function putModifyStatusAvailable() {
|
|
572
|
-
var
|
|
565
|
+
var _this5 = this;
|
|
573
566
|
return {
|
|
574
567
|
disabled: !this.roles.UPDATE,
|
|
575
568
|
path: '/available/:id([a-zA-Z0-9]+)',
|
|
576
569
|
method: [(0, _middleware.adminRoleMiddleware)([this.roles.UPDATE], this.roleMiddlewareOptions), (0, _middleware.validateMiddleware)(_constant.REQUEST_TYPE.PARAMS, _validator.rulesId), /*#__PURE__*/function () {
|
|
577
|
-
var
|
|
570
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee18(req, res) {
|
|
578
571
|
var item;
|
|
579
|
-
return _regeneratorRuntime().wrap(function
|
|
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
|
-
}
|
|
572
|
+
return _regeneratorRuntime().wrap(function _callee18$(_context18) {
|
|
573
|
+
while (1) switch (_context18.prev = _context18.next) {
|
|
574
|
+
case 0:
|
|
575
|
+
_context18.next = 2;
|
|
576
|
+
return _this5.repository.findOneById(req.params.id);
|
|
577
|
+
case 2:
|
|
578
|
+
item = _context18.sent;
|
|
579
|
+
if (item) {
|
|
580
|
+
_context18.next = 5;
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
return _context18.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
584
|
+
case 5:
|
|
585
|
+
_context18.next = 7;
|
|
586
|
+
return item.modifyStatusAvailable(req.user.id);
|
|
587
|
+
case 7:
|
|
588
|
+
_context18.next = 9;
|
|
589
|
+
return _this5.afterModify(item);
|
|
590
|
+
case 9:
|
|
591
|
+
item = _context18.sent;
|
|
592
|
+
return _context18.abrupt("return", res.success(item, _this5.guardResponse, _this5.allowResponse));
|
|
593
|
+
case 11:
|
|
594
|
+
case "end":
|
|
595
|
+
return _context18.stop();
|
|
605
596
|
}
|
|
606
|
-
},
|
|
597
|
+
}, _callee18);
|
|
607
598
|
}));
|
|
608
|
-
return function (
|
|
609
|
-
return
|
|
599
|
+
return function (_x32, _x33) {
|
|
600
|
+
return _ref14.apply(this, arguments);
|
|
610
601
|
};
|
|
611
602
|
}()]
|
|
612
603
|
};
|
|
@@ -614,44 +605,42 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
614
605
|
}, {
|
|
615
606
|
key: "putModifyStatusUnavailable",
|
|
616
607
|
value: function putModifyStatusUnavailable() {
|
|
617
|
-
var
|
|
608
|
+
var _this6 = this;
|
|
618
609
|
return {
|
|
619
610
|
disabled: !this.roles.UPDATE,
|
|
620
611
|
path: '/unavailable/:id([a-zA-Z0-9]+)',
|
|
621
612
|
method: [(0, _middleware.adminRoleMiddleware)([this.roles.UPDATE], this.roleMiddlewareOptions), (0, _middleware.validateMiddleware)(_constant.REQUEST_TYPE.PARAMS, _validator.rulesId), /*#__PURE__*/function () {
|
|
622
|
-
var
|
|
613
|
+
var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee19(req, res) {
|
|
623
614
|
var item;
|
|
624
|
-
return _regeneratorRuntime().wrap(function
|
|
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
|
-
}
|
|
615
|
+
return _regeneratorRuntime().wrap(function _callee19$(_context19) {
|
|
616
|
+
while (1) switch (_context19.prev = _context19.next) {
|
|
617
|
+
case 0:
|
|
618
|
+
_context19.next = 2;
|
|
619
|
+
return _this6.repository.findOneById(req.params.id);
|
|
620
|
+
case 2:
|
|
621
|
+
item = _context19.sent;
|
|
622
|
+
if (item) {
|
|
623
|
+
_context19.next = 5;
|
|
624
|
+
break;
|
|
625
|
+
}
|
|
626
|
+
return _context19.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
627
|
+
case 5:
|
|
628
|
+
_context19.next = 7;
|
|
629
|
+
return item.modifyStatusUnavailable(req.body.message, req.user.id);
|
|
630
|
+
case 7:
|
|
631
|
+
_context19.next = 9;
|
|
632
|
+
return _this6.afterModify(item);
|
|
633
|
+
case 9:
|
|
634
|
+
item = _context19.sent;
|
|
635
|
+
return _context19.abrupt("return", res.success(item, _this6.guardResponse, _this6.allowResponse));
|
|
636
|
+
case 11:
|
|
637
|
+
case "end":
|
|
638
|
+
return _context19.stop();
|
|
650
639
|
}
|
|
651
|
-
},
|
|
640
|
+
}, _callee19);
|
|
652
641
|
}));
|
|
653
|
-
return function (
|
|
654
|
-
return
|
|
642
|
+
return function (_x34, _x35) {
|
|
643
|
+
return _ref15.apply(this, arguments);
|
|
655
644
|
};
|
|
656
645
|
}()]
|
|
657
646
|
};
|
|
@@ -659,44 +648,42 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
659
648
|
}, {
|
|
660
649
|
key: "putModifyStatusWaiting",
|
|
661
650
|
value: function putModifyStatusWaiting() {
|
|
662
|
-
var
|
|
651
|
+
var _this7 = this;
|
|
663
652
|
return {
|
|
664
653
|
disabled: !this.roles.UPDATE,
|
|
665
654
|
path: '/waiting/:id([a-zA-Z0-9]+)',
|
|
666
655
|
method: [(0, _middleware.adminRoleMiddleware)([this.roles.UPDATE], this.roleMiddlewareOptions), (0, _middleware.validateMiddleware)(_constant.REQUEST_TYPE.PARAMS, _validator.rulesId), /*#__PURE__*/function () {
|
|
667
|
-
var
|
|
656
|
+
var _ref16 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee20(req, res) {
|
|
668
657
|
var item;
|
|
669
|
-
return _regeneratorRuntime().wrap(function
|
|
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
|
-
}
|
|
658
|
+
return _regeneratorRuntime().wrap(function _callee20$(_context20) {
|
|
659
|
+
while (1) switch (_context20.prev = _context20.next) {
|
|
660
|
+
case 0:
|
|
661
|
+
_context20.next = 2;
|
|
662
|
+
return _this7.repository.findOneById(req.params.id);
|
|
663
|
+
case 2:
|
|
664
|
+
item = _context20.sent;
|
|
665
|
+
if (item) {
|
|
666
|
+
_context20.next = 5;
|
|
667
|
+
break;
|
|
668
|
+
}
|
|
669
|
+
return _context20.abrupt("return", res.error(_error.NOT_EXISTS));
|
|
670
|
+
case 5:
|
|
671
|
+
_context20.next = 7;
|
|
672
|
+
return item.modifyStatusWaiting(req.user.id);
|
|
673
|
+
case 7:
|
|
674
|
+
_context20.next = 9;
|
|
675
|
+
return _this7.afterModify(item);
|
|
676
|
+
case 9:
|
|
677
|
+
item = _context20.sent;
|
|
678
|
+
return _context20.abrupt("return", res.success(item, _this7.guardResponse, _this7.allowResponse));
|
|
679
|
+
case 11:
|
|
680
|
+
case "end":
|
|
681
|
+
return _context20.stop();
|
|
695
682
|
}
|
|
696
|
-
},
|
|
683
|
+
}, _callee20);
|
|
697
684
|
}));
|
|
698
|
-
return function (
|
|
699
|
-
return
|
|
685
|
+
return function (_x36, _x37) {
|
|
686
|
+
return _ref16.apply(this, arguments);
|
|
700
687
|
};
|
|
701
688
|
}()]
|
|
702
689
|
};
|
|
@@ -704,20 +691,18 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
704
691
|
}, {
|
|
705
692
|
key: "afterDelete",
|
|
706
693
|
value: function () {
|
|
707
|
-
var _afterDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
708
|
-
return _regeneratorRuntime().wrap(function
|
|
709
|
-
while (1) {
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
return _context20.stop();
|
|
716
|
-
}
|
|
694
|
+
var _afterDelete = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee21(item) {
|
|
695
|
+
return _regeneratorRuntime().wrap(function _callee21$(_context21) {
|
|
696
|
+
while (1) switch (_context21.prev = _context21.next) {
|
|
697
|
+
case 0:
|
|
698
|
+
return _context21.abrupt("return", item);
|
|
699
|
+
case 1:
|
|
700
|
+
case "end":
|
|
701
|
+
return _context21.stop();
|
|
717
702
|
}
|
|
718
|
-
},
|
|
703
|
+
}, _callee21);
|
|
719
704
|
}));
|
|
720
|
-
function afterDelete(
|
|
705
|
+
function afterDelete(_x38) {
|
|
721
706
|
return _afterDelete.apply(this, arguments);
|
|
722
707
|
}
|
|
723
708
|
return afterDelete;
|
|
@@ -743,20 +728,18 @@ var AdminController = /*#__PURE__*/function (_Controller) {
|
|
|
743
728
|
}, {
|
|
744
729
|
key: "afterDestroy",
|
|
745
730
|
value: function () {
|
|
746
|
-
var _afterDestroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
747
|
-
return _regeneratorRuntime().wrap(function
|
|
748
|
-
while (1) {
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
return _context21.stop();
|
|
755
|
-
}
|
|
731
|
+
var _afterDestroy = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee22(item) {
|
|
732
|
+
return _regeneratorRuntime().wrap(function _callee22$(_context22) {
|
|
733
|
+
while (1) switch (_context22.prev = _context22.next) {
|
|
734
|
+
case 0:
|
|
735
|
+
return _context22.abrupt("return", item);
|
|
736
|
+
case 1:
|
|
737
|
+
case "end":
|
|
738
|
+
return _context22.stop();
|
|
756
739
|
}
|
|
757
|
-
},
|
|
740
|
+
}, _callee22);
|
|
758
741
|
}));
|
|
759
|
-
function afterDestroy(
|
|
742
|
+
function afterDestroy(_x39) {
|
|
760
743
|
return _afterDestroy.apply(this, arguments);
|
|
761
744
|
}
|
|
762
745
|
return afterDestroy;
|