summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--dist/models/Member.js7
-rw-r--r--dist/models/Member.js.map2
-rw-r--r--src/models/Member.ts9
3 files changed, 10 insertions, 8 deletions
diff --git a/dist/models/Member.js b/dist/models/Member.js
index 8b87dc9f..750ff802 100644
--- a/dist/models/Member.js
+++ b/dist/models/Member.js
@@ -12,7 +12,7 @@ const MuteConfig = {
     selected_time_window: Number,
 };
 exports.MemberSchema = new mongoose_1.Schema({
-    id: mongoose_1.Types.Long,
+    id: { type: mongoose_1.Types.Long, required: true },
     guild_id: mongoose_1.Types.Long,
     nick: String,
     roles: [mongoose_1.Types.Long],
@@ -40,9 +40,10 @@ exports.MemberSchema = new mongoose_1.Schema({
     },
 });
 exports.MemberSchema.virtual("user", {
-    model: User_1.UserModel,
-    localField: "user",
+    ref: User_1.UserModel,
+    localField: "id",
     foreignField: "id",
+    justOne: true,
 });
 // @ts-ignore
 exports.MemberModel = Database_1.default.model("Member", exports.MemberSchema, "members");
diff --git a/dist/models/Member.js.map b/dist/models/Member.js.map
index f5b7064d..d6cb4574 100644
--- a/dist/models/Member.js.map
+++ b/dist/models/Member.js.map
@@ -1 +1 @@
-{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../src/models/Member.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAqD;AACrD,uCAAmD;AACnD,gEAAkC;AAyClC,MAAM,UAAU,GAAG;IAClB,QAAQ,EAAE,MAAM;IAChB,oBAAoB,EAAE,MAAM;CAC5B,CAAC;AAEW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,EAAE,EAAE,gBAAK,CAAC,IAAI;IACd,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,MAAM;IACrB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE;QACT,iBAAiB,EAAE;YAClB;gBACC,UAAU,EAAE,gBAAK,CAAC,IAAI;gBACtB,qBAAqB,EAAE,MAAM;gBAC7B,WAAW,EAAE,UAAU;gBACvB,KAAK,EAAE,OAAO;aACd;SACD;QACD,qBAAqB,EAAE,MAAM;QAC7B,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,OAAO;QACd,iBAAiB,EAAE,OAAO;QAC1B,cAAc,EAAE,OAAO;QACvB,OAAO,EAAE,MAAM;KACf;CACD,CAAC,CAAC;AAEH,oBAAY,CAAC,OAAO,CAAC,MAAM,EAAE;IAC5B,KAAK,EAAE,gBAAS;IAChB,UAAU,EAAE,MAAM;IAClB,YAAY,EAAE,IAAI;CAClB,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"}
\ No newline at end of file
+{"version":3,"file":"Member.js","sourceRoot":"","sources":["../../src/models/Member.ts"],"names":[],"mappings":";;;;;;AAAA,iCAAqD;AACrD,uCAAmD;AACnD,gEAAkC;AAyClC,MAAM,UAAU,GAAG;IAClB,QAAQ,EAAE,MAAM;IAChB,oBAAoB,EAAE,MAAM;CAC5B,CAAC;AAEW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,EAAE,EAAE,EAAE,IAAI,EAAE,gBAAK,CAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;IACxC,QAAQ,EAAE,gBAAK,CAAC,IAAI;IACpB,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,CAAC,gBAAK,CAAC,IAAI,CAAC;IACnB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,MAAM;IACrB,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,OAAO;IACb,OAAO,EAAE,OAAO;IAChB,QAAQ,EAAE;QACT,iBAAiB,EAAE;YAClB;gBACC,UAAU,EAAE,gBAAK,CAAC,IAAI;gBACtB,qBAAqB,EAAE,MAAM;gBAC7B,WAAW,EAAE,UAAU;gBACvB,KAAK,EAAE,OAAO;aACd;SACD;QACD,qBAAqB,EAAE,MAAM;QAC7B,WAAW,EAAE,OAAO;QACpB,WAAW,EAAE,UAAU;QACvB,KAAK,EAAE,OAAO;QACd,iBAAiB,EAAE,OAAO;QAC1B,cAAc,EAAE,OAAO;QACvB,OAAO,EAAE,MAAM;KACf;CACD,CAAC,CAAC;AAEH,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE;IACpC,GAAG,EAAE,gBAAS;IACd,UAAU,EAAE,IAAI;IAChB,YAAY,EAAE,IAAI;IAClB,OAAO,EAAE,IAAI;CACb,CAAC,CAAC;AAEH,aAAa;AACA,QAAA,WAAW,GAAG,kBAAE,CAAC,KAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,SAAS,CAAC,CAAC"}
\ No newline at end of file
diff --git a/src/models/Member.ts b/src/models/Member.ts
index c177c6c9..5e0e0014 100644
--- a/src/models/Member.ts
+++ b/src/models/Member.ts
@@ -47,7 +47,7 @@ const MuteConfig = {
 };
 
 export const MemberSchema = new Schema({
-	id: Types.Long,
+	id: { type: Types.Long, required: true },
 	guild_id: Types.Long,
 	nick: String,
 	roles: [Types.Long],
@@ -75,10 +75,11 @@ export const MemberSchema = new Schema({
 	},
 });
 
-MemberSchema.virtual("user", {
-	model: UserModel,
-	localField: "user",
+exports.MemberSchema.virtual("user", {
+	ref: UserModel,
+	localField: "id",
 	foreignField: "id",
+	justOne: true,
 });
 
 // @ts-ignore