mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-23 02:42:28 +01:00
📝 typo
This commit is contained in:
parent
5c11bf1b87
commit
72204ed419
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@ -19,6 +19,7 @@
|
||||
"request": "launch",
|
||||
"skipFiles": ["<node_internals>/**"],
|
||||
"runtimeArgs": ["--nolazy", "-r", "ts-node/register/transpile-only"],
|
||||
"preLaunchTask": "tsc: build - tsconfig.json",
|
||||
"type": "node",
|
||||
"resolveSourceMapLocations": ["${workspaceFolder}/**", "!**/node_modules/**"]
|
||||
}
|
||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1363,7 +1363,7 @@
|
||||
},
|
||||
"node_modules/fosscord-server-util": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#371a56859695321bfa862a1c66d27279018cc864",
|
||||
"resolved": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#3bdbd9340edf4f3edd728624499dbcaaf08a25ed",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
@ -5077,7 +5077,7 @@
|
||||
"integrity": "sha1-mMI9qxF1ZXuMBXPozszZGw/xjIQ="
|
||||
},
|
||||
"fosscord-server-util": {
|
||||
"version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#371a56859695321bfa862a1c66d27279018cc864",
|
||||
"version": "git+ssh://git@github.com/fosscord/fosscord-server-util.git#3bdbd9340edf4f3edd728624499dbcaaf08a25ed",
|
||||
"from": "fosscord-server-util@github:fosscord/fosscord-server-util",
|
||||
"requires": {
|
||||
"jsonwebtoken": "^8.5.1",
|
||||
|
@ -39,7 +39,7 @@ router.post("/", check(InviteCreateSchema), async (req: Request, res: Response)
|
||||
inviter_id: usID,
|
||||
};
|
||||
|
||||
await new InviteModel(invite).save(); // ! samuel ist ein hurensohn
|
||||
await new InviteModel(invite).save();
|
||||
|
||||
await emitEvent({ event: "INVITE_CREATE", data: invite } as InviteCreateEvent);
|
||||
res.status(201).send(invite);
|
||||
|
@ -2,13 +2,26 @@ import mongoose, { Schema, Types } from "mongoose";
|
||||
import { Long as MongoTypeLong } from "mongodb";
|
||||
require("mongoose-long")(mongoose);
|
||||
|
||||
const partSchema = new Schema({
|
||||
long: {
|
||||
type: mongoose.Types.Long,
|
||||
},
|
||||
const userSchema = new Schema({
|
||||
id: MongoTypeLong,
|
||||
});
|
||||
|
||||
const Part = mongoose.model("Part", partSchema, "test");
|
||||
const messageSchema = new Schema({
|
||||
id: MongoTypeLong,
|
||||
content: String,
|
||||
});
|
||||
const message = mongoose.model("message", messageSchema, "messages");
|
||||
const user = mongoose.model("user", userSchema, "users");
|
||||
|
||||
messageSchema.virtual("u", {
|
||||
ref: user,
|
||||
localField: "id",
|
||||
foreignField: "id",
|
||||
justOne: true,
|
||||
});
|
||||
|
||||
messageSchema.set("toObject", { virtuals: true });
|
||||
messageSchema.set("toJSON", { virtuals: true });
|
||||
|
||||
async function main() {
|
||||
const conn = await mongoose.connect("mongodb://localhost:27017/lambert?readPreference=secondaryPreferred", {
|
||||
@ -17,12 +30,12 @@ async function main() {
|
||||
});
|
||||
console.log("connected");
|
||||
|
||||
const part = new Part({ long: 390810485244821505n });
|
||||
// const u = await new user({ name: "test" }).save();
|
||||
// await new message({ user: u._id, content: "test" }).save();
|
||||
|
||||
// await part.save();
|
||||
console.log("saved");
|
||||
const test = await Part.find({});
|
||||
console.log(test);
|
||||
const test = await message.findOne({}).populate("u").exec();
|
||||
// @ts-ignore
|
||||
console.log(test?.toJSON());
|
||||
}
|
||||
|
||||
main();
|
||||
|
Loading…
Reference in New Issue
Block a user