diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/Database.ts | 2 | ||||
-rw-r--r-- | src/util/Permissions.ts | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/util/Database.ts b/src/util/Database.ts index 339ac65b..68909c97 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -18,6 +18,8 @@ export default <Connection>connection; function transform<T>(document: T) { // @ts-ignore + if (!document || !document.toObject) return document; + // @ts-ignore return document.toObject({ virtuals: true }); } diff --git a/src/util/Permissions.ts b/src/util/Permissions.ts index fb8ed2b0..ab195813 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -214,9 +214,7 @@ export async function getPermission( if (!member) member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); if (!member) throw new HTTPError("Member not found"); - roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }) - .lean() - .exec(); + roles = await RoleModel.find({ guild_id, id: { $in: member.roles } }).exec(); } var permission = Permissions.finalPermission({ |