summary refs log tree commit diff
path: root/dist/util/MongoBigInt.js
diff options
context:
space:
mode:
authorafeuerstein <32029275+afeuerstein@users.noreply.github.com>2021-04-06 21:32:44 +0200
committerafeuerstein <32029275+afeuerstein@users.noreply.github.com>2021-04-06 21:32:44 +0200
commit0e8356e9b1acd95be5b94f0e55bba9d749a36d12 (patch)
tree628a02e478cf8df2b4c12eab14bfb7f1dac03be2 /dist/util/MongoBigInt.js
parent:bug: fix Message Model (diff)
downloadserver-0e8356e9b1acd95be5b94f0e55bba9d749a36d12.tar.xz
remove compiled typescript code from repo
Diffstat (limited to 'dist/util/MongoBigInt.js')
-rw-r--r--dist/util/MongoBigInt.js76
1 files changed, 0 insertions, 76 deletions
diff --git a/dist/util/MongoBigInt.js b/dist/util/MongoBigInt.js
deleted file mode 100644

index 3e04fac4..00000000 --- a/dist/util/MongoBigInt.js +++ /dev/null
@@ -1,76 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const mongoose_1 = __importDefault(require("mongoose")); -class LongSchema extends mongoose_1.default.SchemaType { - constructor() { - super(...arguments); - this.$conditionalHandlers = { - $lt: this.handleSingle, - $lte: this.handleSingle, - $gt: this.handleSingle, - $gte: this.handleSingle, - $ne: this.handleSingle, - $in: this.handleArray, - $nin: this.handleArray, - $mod: this.handleArray, - $all: this.handleArray, - $bitsAnySet: this.handleArray, - $bitsAllSet: this.handleArray, - }; - } - handleSingle(val) { - return this.cast(val, null, null, "handle"); - } - handleArray(val) { - var self = this; - return val.map(function (m) { - return self.cast(m, null, null, "handle"); - }); - } - checkRequired(val) { - return null != val; - } - cast(val, scope, init, type) { - if (null === val) - return val; - if ("" === val) - return null; - if (typeof val === "bigint") { - return mongoose_1.default.mongo.Long.fromString(val.toString()); - } - if (val instanceof mongoose_1.default.mongo.Long) { - if (type === "handle" || init == false) - return val; - return BigInt(val.toString()); - } - if (val instanceof Number || "number" == typeof val) - return BigInt(val); - if (!Array.isArray(val) && val.toString) - return BigInt(val.toString()); - // @ts-ignore - throw new SchemaType.CastError("Long", val); - } - castForQuery($conditional, value) { - var handler; - if (2 === arguments.length) { - // @ts-ignore - handler = this.$conditionalHandlers[$conditional]; - if (!handler) { - throw new Error("Can't use " + $conditional + " with Long."); - } - return handler.call(this, value); - } - else { - return this.cast($conditional, null, null, "query"); - } - } -} -LongSchema.cast = mongoose_1.default.SchemaType.cast; -LongSchema.set = mongoose_1.default.SchemaType.set; -LongSchema.get = mongoose_1.default.SchemaType.get; -mongoose_1.default.Schema.Types.Long = LongSchema; -mongoose_1.default.Types.Long = mongoose_1.default.mongo.Long; -//# sourceMappingURL=MongoBigInt.js.map \ No newline at end of file