adding asset manager and other new features

This commit is contained in:
RandyJC
2025-12-08 22:08:06 +01:00
parent 03fdeb643a
commit 01b26c59f0
13 changed files with 435 additions and 39 deletions

View File

@@ -111,6 +111,27 @@ io.on("connection", (socket) => {
}
})
socket.on("manager:deleteQuizz", ({ id }) => {
if (!id) {
socket.emit("manager:errorMessage", "Invalid quizz id")
return
}
try {
const deleted = Config.deleteQuizz(id)
if (!deleted) {
socket.emit("manager:errorMessage", "Quizz not found")
return
}
socket.emit("manager:quizzDeleted", id)
socket.emit("manager:quizzList", Config.quizz())
} catch (error) {
console.error("Failed to delete quizz", error)
socket.emit("manager:errorMessage", "Failed to delete quizz")
}
})
socket.on("game:create", (quizzId) => {
const quizzList = Config.quizz()
const quizz = quizzList.find((q) => q.id === quizzId)
@@ -167,6 +188,14 @@ io.on("connection", (socket) => {
withGame(gameId, socket, (game) => game.abortRound(socket))
)
socket.on("manager:pauseCooldown", ({ gameId }) =>
withGame(gameId, socket, (game) => game.pauseCooldown(socket))
)
socket.on("manager:resumeCooldown", ({ gameId }) =>
withGame(gameId, socket, (game) => game.resumeCooldown(socket))
)
socket.on("manager:nextQuestion", ({ gameId }) =>
withGame(gameId, socket, (game) => game.nextRound(socket))
)