feat: delete "deleteSession" method, validate questId and sessionId

This commit is contained in:
wancat authored and Lin, Hung-Shin committed 2023-11-14 10:44:52 +08:00
1 parent a7422853fa
commit 5df4967a85
12 files changed
+67 -99

No files matched your search

@@ -1,4 +1,5 @@
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 })
@@ -12,8 +13,8 @@ export async function getQuests(req, res) {
}
export async function getQuestDetail(req, res) {
const { id } = req.params
const quest = await Quest.findById(id)
const { questId } = matchedData(req)
const quest = await Quest.findById(questId)
if (!quest) {
res.status(404).json({ message: 'Quest not found.' })
return