mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 11:30:13 +08:00
refactor: refactor commandHandler to class
This commit is contained in:
1 parent
c3683ddaea
commit
3b8264e39e
2 files changed
+79
-70
No files matched your search
@@ -2,7 +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'
|
||||
import CommandHandler from '../../game/commandHandler.js'
|
||||
|
||||
export async function newCommand(req, res) {
|
||||
console.log('new command:', req.body)
|
||||
@@ -48,7 +48,9 @@ export async function newCommand(req, res) {
|
||||
|
||||
await c.save()
|
||||
|
||||
const response = await commandHandler(session, c, additionalData)
|
||||
const commandHandler = new CommandHandler(session, c, additionalData)
|
||||
|
||||
const response = await commandHandler.run()
|
||||
console.log(response)
|
||||
|
||||
res.status(201).json(response)
|
||||
|
||||
Reference in new issue
Block a user