summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-22 21:30:38 +0100
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-02-22 21:30:38 +0100
commit92a6c981ce12f4484509d0388cb1fba2a52b55c4 (patch)
treec73fc11423ee7cbcac066b15698793f13679e98e
parent:wrench: build (diff)
downloadserver-92a6c981ce12f4484509d0388cb1fba2a52b55c4.tar.xz
:sparkles: MemberModel add virtual user field
-rw-r--r--dist/models/Guild.js1
-rw-r--r--dist/models/Guild.js.map2
-rw-r--r--dist/models/Member.d.ts3
-rw-r--r--dist/models/Member.js6
-rw-r--r--dist/models/Member.js.map2
-rw-r--r--src/models/Guild.ts2
-rw-r--r--src/models/Member.ts12
7 files changed, 23 insertions, 5 deletions
diff --git a/dist/models/Guild.js b/dist/models/Guild.js
index 4996d06a..6554e312 100644
--- a/dist/models/Guild.js
+++ b/dist/models/Guild.js
@@ -44,6 +44,7 @@ exports.GuildSchema = new mongoose_1.Schema({
     widget_channel_id: mongoose_1.Types.Long,
     widget_enabled: Boolean,
 });
+// GuildSchema.virtual
 // @ts-ignore
 exports.GuildModel = Database_1.default.model("Guild", exports.GuildSchema, "guilds");
 //# sourceMappingURL=Guild.js.map
\ No newline at end of file
diff --git a/dist/models/Guild.js.map b/dist/models/Guild.js.map
index e5e4c796..ca291591 100644
--- a/dist/models/Guild.js.map
+++ b/dist/models/Guild.js.map
@@ -1 +1 @@
-{"version":3,"file":"Guild.js","sourceRoot":"","sources":["../../src/models/Guild.ts"],"names":[],"mappings":";;;;;;AAAA,uCAA0D;AAC1D,gEAAkC;AAiDrB,QAAA,WAAW,GAAG,IAAI,iBAAM,CAAC;IACrC,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,WAAW,EAAE,MAAM;IACnB,cAAc,EAAE,gBAAK,CAAC,IAAI;IAC1B,MAAM,EAAE,MAAM;IACd,6BAA6B,EAAE,MAAM;IACrC,WAAW,EAAE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IAClC,YAAY,EAAE,MAAM;IACpB,yBAAyB,EAAE,gBAAK,CAAC,IAAI;IACrC,MAAM,EAAE,MAAM;IACd,gBAAgB,EAAE,gBAAK,CAAC,IAAI;IAC5B,MAAM,EAAE,MAAM;IACd,oBAAoB,EAAE,MAAM;IAC5B,iBAAiB,EAAE,gBAAK,CAAC,IAAI;IAC7B,WAAW,EAAE,OAAO;IACpB,eAAe,EAAE,MAAM;IACvB,kBAAkB,EAAE,MAAM;IAC1B,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC7C,cAAc,EAAE,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IAC/C,iBAAiB,EAAE,gBAAK,CAAC,IAAI;IAC7B,cAAc,EAAE,OAAO;CACvB,CAAC,CAAC;AAEH,sBAAsB;AAEtB,aAAa;AACA,QAAA,UAAU,GAAG,kBAAE,CAAC,KAAK,CAAgB,OAAO,EAAE,mBAAW,EAAE,QAAQ,CAAC,CAAC"}
\ No newline at end of file
diff --git a/dist/models/Member.d.ts b/dist/models/Member.d.ts
index f2d142c6..84f088f1 100644
--- a/dist/models/Member.d.ts
+++ b/dist/models/Member.d.ts
@@ -1,5 +1,5 @@
 /// <reference path="../util/MongoBigInt.d.ts" />
-import { PublicUser } from "./User";
+import { PublicUser, User } from "./User";
 import { Schema, Document } from "mongoose";
 export interface Member {
     id: bigint;
@@ -12,6 +12,7 @@ export interface Member {
     mute: boolean;
     pending: boolean;
     settings: UserGuildSettings;
+    user?: User;
 }
 export interface MemberDocument extends Member, Document {
     id: bigint;
diff --git a/dist/models/Member.js b/dist/models/Member.js
index 0a8f484f..8b87dc9f 100644
--- a/dist/models/Member.js
+++ b/dist/models/Member.js
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
 };
 Object.defineProperty(exports, "__esModule", { value: true });
 exports.MemberModel = exports.MemberSchema = void 0;
+const User_1 = require("./User");
 const mongoose_1 = require("mongoose");
 const Database_1 = __importDefault(require("../util/Database"));
 const MuteConfig = {
@@ -38,6 +39,11 @@ exports.MemberSchema = new mongoose_1.Schema({
         version: Number,
     },
 });
+exports.MemberSchema.virtual("user", {
+    model: User_1.UserModel,
+    localField: "user",
+    foreignField: "id",
+});
 // @ts-ignore
 exports.MemberModel = Database_1.default.model("Member", exports.MemberSchema, "members");
 //# sourceMappingURL=Member.js.map
\ No newline at end of file
diff --git a/dist/models/Member.js.map b/dist/models/Member.js.map
index f43b376f..f5b7064d 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":";;;;;;AACA,uCAA0D;AAC1D,gEAAkC;AAwClC,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,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,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
diff --git a/src/models/Guild.ts b/src/models/Guild.ts
index 8eb7533f..effc20ee 100644
--- a/src/models/Guild.ts
+++ b/src/models/Guild.ts
@@ -87,5 +87,7 @@ export const GuildSchema = new Schema({
 	widget_enabled: Boolean,
 });
 
+// GuildSchema.virtual
+
 // @ts-ignore
 export const GuildModel = db.model<GuildDocument>("Guild", GuildSchema, "guilds");
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;
 }