mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
wip: integrate filegraph into session
This commit is contained in:
1 parent
cdd22634e0
commit
2d95ca382f
13 files changed
+105
-42
No files matched your search
@@ -54,6 +54,7 @@ export const newCommand = asyncHandler(async (req: Request, res: Response) => {
|
||||
await c.save()
|
||||
if (event) {
|
||||
session.completedEvents = gameSession.completedEvents
|
||||
session.graph = gameSession.getGraph()
|
||||
|
||||
if (gameSession.isFinished()) {
|
||||
await finishSession(session)
|
||||
@@ -64,6 +65,7 @@ export const newCommand = asyncHandler(async (req: Request, res: Response) => {
|
||||
responses: gameSession.getResponses(),
|
||||
tasks: gameSession.getTasks(),
|
||||
status: session.status,
|
||||
graphUpdate: command.params,
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ import config from '../config.js'
|
||||
import { protectedProcedure, router } from '../trpc.js'
|
||||
import { questManager } from '../models/quest.js'
|
||||
|
||||
export type SessionDetail = Awaited<ReturnType<typeof sessionDetail>>
|
||||
|
||||
function sessionDetail(session: ISession) {
|
||||
const quest = questManager.get(session.quest)
|
||||
if (!quest) {
|
||||
@@ -22,14 +24,15 @@ function sessionDetail(session: ISession) {
|
||||
)
|
||||
return {
|
||||
_id: session._id.toString(),
|
||||
user: session.user,
|
||||
user: session.user.toString(),
|
||||
quest: session.quest,
|
||||
status: session.status,
|
||||
createdAt: session.createdAt,
|
||||
lastActivityAt: session.lastActivityAt,
|
||||
createdAt: session.createdAt.toISOString(),
|
||||
lastActivityAt: session.lastActivityAt.toISOString(),
|
||||
completedEvents: session.completedEvents,
|
||||
responses: gameSession.getResponses(),
|
||||
tasks: gameSession.getTasks(),
|
||||
graph: gameSession.getGraph(),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user