mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
Get quest list and quest details
+ Add timestamps to quest
This commit is contained in:
1 parent
3637d41529
commit
247c75ff84
4 files changed
+31
-1
No files matched your search
@@ -0,0 +1,19 @@
|
||||
import Quest from '../../models/quest.js'
|
||||
|
||||
export async function getQuests(req, res) {
|
||||
const quests = await Quest.find({}).sort({ order: 1 })
|
||||
res.json(
|
||||
quests.map(({ name, title, order, _id }) => ({
|
||||
id: _id,
|
||||
name,
|
||||
title,
|
||||
order,
|
||||
}))
|
||||
)
|
||||
}
|
||||
|
||||
export async function getQuestDetail(req, res) {
|
||||
const { name } = req.params
|
||||
const quest = await Quest.findOne({ name })
|
||||
res.json(quest)
|
||||
}
|
||||
Reference in new issue
Block a user