릴리스: v1.4.24 topic/template 응답 키 축소
This commit is contained in:
@@ -6,7 +6,7 @@ const router = express.Router()
|
||||
|
||||
router.get('/', async (req, res) => {
|
||||
const topics = await listTopics(req.session?.userId || '', { includePrivate: !!req.session?.isAdmin })
|
||||
res.json({ games: topics, topics })
|
||||
res.json({ topics })
|
||||
})
|
||||
|
||||
router.post('/:topicId/favorite', requireAuth, async (req, res) => {
|
||||
@@ -15,7 +15,7 @@ router.post('/:topicId/favorite', requireAuth, async (req, res) => {
|
||||
await favoriteTopic({ userId: req.session.userId, topicId: topic.id })
|
||||
const topics = await listTopics(req.session.userId)
|
||||
const updated = topics.find((entry) => entry.id === topic.id) || { ...topic, isFavorited: true }
|
||||
res.json({ game: updated, topic: updated })
|
||||
res.json({ topic: updated })
|
||||
})
|
||||
|
||||
router.delete('/:topicId/favorite', requireAuth, async (req, res) => {
|
||||
@@ -24,14 +24,14 @@ router.delete('/:topicId/favorite', requireAuth, async (req, res) => {
|
||||
await unfavoriteTopic({ userId: req.session.userId, topicId: topic.id })
|
||||
const topics = await listTopics(req.session.userId)
|
||||
const updated = topics.find((entry) => entry.id === topic.id) || { ...topic, isFavorited: false }
|
||||
res.json({ game: updated, topic: updated })
|
||||
res.json({ topic: updated })
|
||||
})
|
||||
|
||||
router.get('/:topicId', async (req, res) => {
|
||||
const detail = await getTopicDetail(req.params.topicId)
|
||||
if (!detail) return res.status(404).json({ error: 'not_found' })
|
||||
if (!detail.topic.isPublic && !req.session?.isAdmin) return res.status(404).json({ error: 'not_found' })
|
||||
res.json({ game: detail.topic, topic: detail.topic, items: detail.items })
|
||||
res.json({ topic: detail.topic, items: detail.items })
|
||||
})
|
||||
|
||||
module.exports = router
|
||||
|
||||
Reference in New Issue
Block a user