1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 05:02:37 +01:00

use mongoose autopopulate

This commit is contained in:
Flam3rboy 2021-04-07 20:26:09 +02:00
parent 193e3f5a2c
commit d3d733a975
2 changed files with 50 additions and 38 deletions

83
package-lock.json generated
View File

@ -550,13 +550,14 @@
},
"node_modules/fosscord-server-util": {
"version": "1.0.0",
"resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#3205dc6f6080422b8d2f727fe9e4573b493ffbb1",
"resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#25d901e8e1399afa050b078b88662afede5bd9d1",
"license": "ISC",
"dependencies": {
"jsonwebtoken": "^8.5.1",
"lambert-db": "^1.1.7",
"missing-native-js-functions": "^1.2.2",
"mongodb": "^3.6.4"
"mongodb": "^3.6.6",
"mongoose": "^5.12.3"
}
},
"node_modules/fresh": {
@ -977,14 +978,14 @@
}
},
"node_modules/mongodb": {
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz",
"integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==",
"version": "3.6.6",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz",
"integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==",
"dependencies": {
"bl": "^2.2.1",
"bson": "^1.1.4",
"denque": "^1.4.1",
"require_optional": "^1.0.1",
"optional-require": "^1.0.2",
"safe-buffer": "^5.1.2",
"saslprep": "^1.0.0"
},
@ -1118,17 +1119,17 @@
}
},
"node_modules/mongoose": {
"version": "5.11.15",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.11.15.tgz",
"integrity": "sha512-8T4bT6eCGB7MqCm40oVhnhT/1AyAdwe+y1rYUhdl3ljsks3BpYz8whZgcMkIoh6VoCCjipOXRqZqdk1UByvlYA==",
"version": "5.12.3",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.3.tgz",
"integrity": "sha512-frsSR9yeldaRpSUeTegXCSB0Tu5UGq8sHuHBuEV31Jk3COyxlKFQPL7UsdMhxPUCmk74FpOYSmNwxhWBEqgzQg==",
"dependencies": {
"@types/mongodb": "^3.5.27",
"bson": "^1.1.4",
"kareem": "2.3.2",
"mongodb": "3.6.3",
"mongodb": "3.6.5",
"mongoose-legacy-pluralize": "1.0.2",
"mpath": "0.8.3",
"mquery": "3.2.3",
"mquery": "3.2.5",
"ms": "2.1.2",
"regexp-clone": "1.0.0",
"safe-buffer": "5.2.1",
@ -1152,9 +1153,9 @@
}
},
"node_modules/mongoose/node_modules/mongodb": {
"version": "3.6.3",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz",
"integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==",
"version": "3.6.5",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz",
"integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==",
"dependencies": {
"bl": "^2.2.1",
"bson": "^1.1.4",
@ -1204,9 +1205,9 @@
}
},
"node_modules/mquery": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.3.tgz",
"integrity": "sha512-cIfbP4TyMYX+SkaQ2MntD+F2XbqaBHUYWk3j+kqdDztPWok3tgyssOZxMHMtzbV1w9DaSlvEea0Iocuro41A4g==",
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz",
"integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==",
"dependencies": {
"bluebird": "3.5.1",
"debug": "3.1.0",
@ -1281,6 +1282,14 @@
"wrappy": "1"
}
},
"node_modules/optional-require": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz",
"integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg==",
"engines": {
"node": ">=4"
}
},
"node_modules/p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",
@ -2229,13 +2238,14 @@
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
},
"fosscord-server-util": {
"version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#3205dc6f6080422b8d2f727fe9e4573b493ffbb1",
"version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#25d901e8e1399afa050b078b88662afede5bd9d1",
"from": "fosscord-server-util@github:fosscord/fosscord-server-util",
"requires": {
"jsonwebtoken": "^8.5.1",
"lambert-db": "^1.1.7",
"missing-native-js-functions": "^1.2.2",
"mongodb": "^3.6.4"
"mongodb": "^3.6.6",
"mongoose": "^5.12.3"
}
},
"fresh": {
@ -2556,14 +2566,14 @@
"integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
},
"mongodb": {
"version": "3.6.4",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.4.tgz",
"integrity": "sha512-Y+Ki9iXE9jI+n9bVtbTOOdK0B95d6wVGSucwtBkvQ+HIvVdTCfpVRp01FDC24uhC/Q2WXQ8Lpq3/zwtB5Op9Qw==",
"version": "3.6.6",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.6.tgz",
"integrity": "sha512-WlirMiuV1UPbej5JeCMqE93JRfZ/ZzqE7nJTwP85XzjAF4rRSeq2bGCb1cjfoHLOF06+HxADaPGqT0g3SbVT1w==",
"requires": {
"bl": "^2.2.1",
"bson": "^1.1.4",
"denque": "^1.4.1",
"require_optional": "^1.0.1",
"optional-require": "^1.0.2",
"safe-buffer": "^5.1.2",
"saslprep": "^1.0.0"
}
@ -2643,17 +2653,17 @@
}
},
"mongoose": {
"version": "5.11.15",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.11.15.tgz",
"integrity": "sha512-8T4bT6eCGB7MqCm40oVhnhT/1AyAdwe+y1rYUhdl3ljsks3BpYz8whZgcMkIoh6VoCCjipOXRqZqdk1UByvlYA==",
"version": "5.12.3",
"resolved": "https://registry.npmjs.org/mongoose/-/mongoose-5.12.3.tgz",
"integrity": "sha512-frsSR9yeldaRpSUeTegXCSB0Tu5UGq8sHuHBuEV31Jk3COyxlKFQPL7UsdMhxPUCmk74FpOYSmNwxhWBEqgzQg==",
"requires": {
"@types/mongodb": "^3.5.27",
"bson": "^1.1.4",
"kareem": "2.3.2",
"mongodb": "3.6.3",
"mongodb": "3.6.5",
"mongoose-legacy-pluralize": "1.0.2",
"mpath": "0.8.3",
"mquery": "3.2.3",
"mquery": "3.2.5",
"ms": "2.1.2",
"regexp-clone": "1.0.0",
"safe-buffer": "5.2.1",
@ -2662,9 +2672,9 @@
},
"dependencies": {
"mongodb": {
"version": "3.6.3",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz",
"integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==",
"version": "3.6.5",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.5.tgz",
"integrity": "sha512-mQlYKw1iGbvJJejcPuyTaytq0xxlYbIoVDm2FODR+OHxyEiMR021vc32bTvamgBjCswsD54XIRwhg3yBaWqJjg==",
"requires": {
"bl": "^2.2.1",
"bson": "^1.1.4",
@ -2693,9 +2703,9 @@
"integrity": "sha512-eb9rRvhDltXVNL6Fxd2zM9D4vKBxjVVQNLNijlj7uoXUy19zNDsIif5zR+pWmPCWNKwAtqyo4JveQm4nfD5+eA=="
},
"mquery": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.3.tgz",
"integrity": "sha512-cIfbP4TyMYX+SkaQ2MntD+F2XbqaBHUYWk3j+kqdDztPWok3tgyssOZxMHMtzbV1w9DaSlvEea0Iocuro41A4g==",
"version": "3.2.5",
"resolved": "https://registry.npmjs.org/mquery/-/mquery-3.2.5.tgz",
"integrity": "sha512-VjOKHHgU84wij7IUoZzFRU07IAxd5kWJaDmyUzQlbjHjyoeK5TNeeo8ZsFDtTYnSgpW6n/nMNIHvE3u8Lbrf4A==",
"requires": {
"bluebird": "3.5.1",
"debug": "3.1.0",
@ -2760,6 +2770,11 @@
"wrappy": "1"
}
},
"optional-require": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/optional-require/-/optional-require-1.0.2.tgz",
"integrity": "sha512-HZubVd6IfHsbnpdNF/ICaSAzBUEW1TievpkjY3tB4Jnk8L7+pJ3conPzUt3Mn/6OZx9uzTDOHYPGA8/AxYHBOg=="
},
"p-limit": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz",

View File

@ -10,12 +10,12 @@ import {
ReadyEventData,
UserModel,
toObject,
EVENTEnum,
} from "fosscord-server-util";
import { setupListener } from "../listener/listener";
import { instanceOf } from "lambert-server";
import { IdentifySchema } from "../schema/Identify";
import { Send } from "../util/Send";
import { EVENTEnum } from "fosscord-server-util";
import experiments from "./experiments.json";
import { check } from "./instanceOf";
@ -62,9 +62,6 @@ export async function onIdentify(this: WebSocket, data: Payload) {
};
const guilds = await GuildModel.find({ id: { $in: user.guilds } })
.populate("channels")
.populate("roles")
.populate("emojis")
.populate({ path: "joined_at", match: { id: this.user_id } })
.exec();