mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
fix: remove unused populate
This commit is contained in:
1 parent
fe1f595f0f
commit
277a1aec79
1 file changed
+13
-12
@@ -2,25 +2,26 @@ import { Command } from '@linux-odyssey/models'
|
||||
|
||||
// eslint-disable-next-line import/prefer-default-export
|
||||
export async function errorCommands() {
|
||||
const commands = await Command.find({ error: { $ne: '' } })
|
||||
const commands = await Command.find({
|
||||
$and: [
|
||||
{ error: { $exists: true } },
|
||||
{ error: { $ne: null } },
|
||||
{ error: { $ne: '' } },
|
||||
],
|
||||
})
|
||||
.populate({
|
||||
path: 'session',
|
||||
populate: [
|
||||
{
|
||||
path: 'user',
|
||||
},
|
||||
{ path: 'quest' },
|
||||
],
|
||||
populate: { path: 'user' },
|
||||
})
|
||||
.exec()
|
||||
return commands.map(({ command, error, createdAt, session }) => {
|
||||
const { user, quest } = session
|
||||
return {
|
||||
command,
|
||||
error,
|
||||
createdAt: createdAt.toLocaleString(),
|
||||
user: user.username,
|
||||
quest: quest.id,
|
||||
command: command.slice(0, 20),
|
||||
error: error.slice(0, 50),
|
||||
createdAt: createdAt?.toLocaleString(),
|
||||
user: user?.username,
|
||||
quest,
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user