From 4ee88fe7bae0ff5a04ec4c846edf9361f603a361 Mon Sep 17 00:00:00 2001 From: wancat Date: Sat, 11 Nov 2023 21:28:49 +0800 Subject: [PATCH] feat: add requirements in quest list api --- quests/spell/game.yml | 1 - server/src/api/controllers/questController.js | 6 +++--- server/src/api/routes/authRouter.js | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/quests/spell/game.yml b/quests/spell/game.yml index e56c5f2..a4b9f97 100644 --- a/quests/spell/game.yml +++ b/quests/spell/game.yml @@ -6,7 +6,6 @@ instruction: | requirements: - helloworld - - noexists conditions: pwd_home: &pwd_home diff --git a/server/src/api/controllers/questController.js b/server/src/api/controllers/questController.js index 098a77c..f25f42a 100644 --- a/server/src/api/controllers/questController.js +++ b/server/src/api/controllers/questController.js @@ -2,12 +2,12 @@ import { Quest } from '@linux-odyssey/models' import { matchedData } from 'express-validator' export async function getQuests(req, res) { - const quests = await Quest.find({}).sort({ order: 1 }) + const quests = await Quest.find({}) res.json( - quests.map(({ title, order, _id }) => ({ + quests.map(({ title, _id, requirements }) => ({ _id, title, - order, + requirements, })) ) } diff --git a/server/src/api/routes/authRouter.js b/server/src/api/routes/authRouter.js index 8bea9a9..6307264 100644 --- a/server/src/api/routes/authRouter.js +++ b/server/src/api/routes/authRouter.js @@ -32,7 +32,7 @@ router.post( router.post('/register', authenticateRateLimit, registerValidators, register) -router.post('/logout', authenticateRateLimit, logout) +router.post('/logout', logout) router.get('/check-username', checkUsernameValidators, (req, res) => res.json({ available: true })