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 8debfa08..6b29248c 100644 --- a/src/util/Permissions.ts +++ b/src/util/Permissions.ts @@ -211,9 +211,7 @@ export async function getPermission( if (!member) member = await MemberModel.findOne({ guild_id, id: user_id }, "roles").exec(); if (!member) throw new Error("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({ |