🐛 fix Database toObject
This commit is contained in:
		
							parent
							
								
									0e7efce655
								
							
						
					
					
						commit
						f526bbdcbc
					
				| @ -17,6 +17,8 @@ const connection = mongoose.createConnection(uri, { | ||||
| export default <Connection>connection; | ||||
| 
 | ||||
| function transform<T>(document: T) { | ||||
| 	// @ts-ignore
 | ||||
| 	if (!document || !document.toObject) return document; | ||||
| 	// @ts-ignore
 | ||||
| 	return document.toObject({ virtuals: true }); | ||||
| } | ||||
|  | ||||
| @ -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({ | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Flam3rboy
						Flam3rboy