mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add status, lastActivityAt column to session
This commit is contained in:
1 parent
bdb979e608
commit
2c866d2e83
4 files changed
+32
-1
No files matched your search
@@ -26,10 +26,18 @@ export async function newCommand(req, res) {
|
||||
const session = await Session.findById(sessionId)
|
||||
|
||||
if (!session) {
|
||||
res.status(401).json({ message: 'session not found' })
|
||||
res.status(404).json({ message: 'session not found' })
|
||||
return
|
||||
}
|
||||
|
||||
if (session.status !== 'active') {
|
||||
res.status(400).json({ message: 'session is not active' })
|
||||
return
|
||||
}
|
||||
|
||||
session.lastActivityAt = new Date()
|
||||
await session.save()
|
||||
|
||||
const c = new Command({
|
||||
session,
|
||||
command,
|
||||
|
||||
Reference in new issue
Block a user