summary refs log tree commit diff
path: root/src/models/Member.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/models/Member.ts')
-rw-r--r--src/models/Member.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/models/Member.ts b/src/models/Member.ts
index a377f54e..c177c6c9 100644
--- a/src/models/Member.ts
+++ b/src/models/Member.ts
@@ -1,5 +1,5 @@
-import { PublicUser } from "./User";
-import { Schema, model, Types, Document } from "mongoose";
+import { PublicUser, User, UserModel } from "./User";
+import { Schema, Types, Document } from "mongoose";
 import db from "../util/Database";
 
 export interface Member {
@@ -13,6 +13,7 @@ export interface Member {
 	mute: boolean;
 	pending: boolean;
 	settings: UserGuildSettings;
+	user?: User;
 }
 
 export interface MemberDocument extends Member, Document {
@@ -74,9 +75,16 @@ export const MemberSchema = new Schema({
 	},
 });
 
+MemberSchema.virtual("user", {
+	model: UserModel,
+	localField: "user",
+	foreignField: "id",
+});
+
 // @ts-ignore
 export const MemberModel = db.model<MemberDocument>("Member", MemberSchema, "members");
 
+// @ts-ignore
 export interface PublicMember extends Omit<Member, "settings" | "id"> {
 	user: PublicUser;
 }