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
|
// eslint-disable-next-line import/prefer-default-export
|
||||||
export async function errorCommands() {
|
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({
|
.populate({
|
||||||
path: 'session',
|
path: 'session',
|
||||||
populate: [
|
populate: { path: 'user' },
|
||||||
{
|
|
||||||
path: 'user',
|
|
||||||
},
|
|
||||||
{ path: 'quest' },
|
|
||||||
],
|
|
||||||
})
|
})
|
||||||
.exec()
|
.exec()
|
||||||
return commands.map(({ command, error, createdAt, session }) => {
|
return commands.map(({ command, error, createdAt, session }) => {
|
||||||
const { user, quest } = session
|
const { user, quest } = session
|
||||||
return {
|
return {
|
||||||
command,
|
command: command.slice(0, 20),
|
||||||
error,
|
error: error.slice(0, 50),
|
||||||
createdAt: createdAt.toLocaleString(),
|
createdAt: createdAt?.toLocaleString(),
|
||||||
user: user.username,
|
user: user?.username,
|
||||||
quest: quest.id,
|
quest,
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user