feat: add requirements in quest list api

This commit is contained in:
wancat authored and Lin, Hung-Shin committed 2023-11-14 10:44:52 +08:00
1 parent f973982ec4
commit 4ee88fe7ba
3 files changed
+4 -5

No files matched your search

@@ -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,
}))
)
}