mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
Directly use folder name as _id in Quest
This commit is contained in:
1 parent
0d9b068678
commit
3e9e14399a
4 files changed
+21
-30
No files matched your search
@@ -4,7 +4,7 @@ export async function getQuests(req, res) {
|
||||
const quests = await Quest.find({}).sort({ order: 1 })
|
||||
res.json(
|
||||
quests.map(({ name, title, order, _id }) => ({
|
||||
id: _id,
|
||||
_id,
|
||||
name,
|
||||
title,
|
||||
order,
|
||||
@@ -13,8 +13,8 @@ export async function getQuests(req, res) {
|
||||
}
|
||||
|
||||
export async function getQuestDetail(req, res) {
|
||||
const { name } = req.params
|
||||
const quest = await Quest.findOne({ name })
|
||||
const { id } = req.params
|
||||
const quest = await Quest.findById(id)
|
||||
if (!quest) {
|
||||
res.status(404).json({ message: 'Quest not found.' })
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user