mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-08 11:30:12 +08:00
feat: add error commands page
This commit is contained in:
1 parent
d249207283
commit
50e53b5667
6 files changed
+60
-1
No files matched your search
@@ -0,0 +1,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: '' } })
|
||||
.populate({
|
||||
path: 'session',
|
||||
populate: [
|
||||
{
|
||||
path: 'user',
|
||||
},
|
||||
{ path: 'quest' },
|
||||
],
|
||||
})
|
||||
.exec()
|
||||
return commands.map(({ command, error, createdAt, session }) => {
|
||||
const { user, quest } = session
|
||||
return {
|
||||
command,
|
||||
error,
|
||||
createdAt: createdAt.toLocaleString(),
|
||||
user: user.username,
|
||||
quest: quest.id,
|
||||
}
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user