mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: add commandHandler
This commit is contained in:
1 parent
0de4b6ac9d
commit
094332da53
7 files changed
+66
-6
No files matched your search
@@ -2,6 +2,7 @@
|
||||
import Command from '../../models/command.js'
|
||||
import Session from '../../models/session.js'
|
||||
import { verifySessionJWT } from '../../utils/auth.js'
|
||||
import commandHandler from '../../game/commandHandler.js'
|
||||
|
||||
export async function newCommand(req, res) {
|
||||
console.log('new command:', req.body)
|
||||
@@ -38,7 +39,8 @@ export async function newCommand(req, res) {
|
||||
|
||||
await c.save()
|
||||
|
||||
res.status(201).json({
|
||||
responses: ['Hello, world!', 'How are you?'],
|
||||
})
|
||||
const response = await commandHandler(session, c)
|
||||
console.log(response)
|
||||
|
||||
res.status(201).json(response)
|
||||
}
|
||||
@@ -23,9 +23,11 @@ export async function createSession(req, res) {
|
||||
}
|
||||
|
||||
try {
|
||||
const progress = quest.stages[0].id
|
||||
const newSession = new Session({
|
||||
user: req.user,
|
||||
quest,
|
||||
progress,
|
||||
containerId: `quest-${quest.id}-${req.user.username}-${Date.now()}`,
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user