Merge pull request #134 from y574444354/fix/favorite-list-all-types

fix: favorite list route should respect type query parameter
This commit is contained in:
linkai0924 2026-05-19 17:59:42 +08:00 committed by GitHub
commit be10194239
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -3,6 +3,7 @@ import {
listFavoriteItems,
loadFavoriteItem,
unloadFavoriteItem,
type FavoriteItemType,
} from '../../costrict/favorite/favorite.js'
import { notFound } from '../errors.js'
@ -10,7 +11,8 @@ export function createFavoriteRoutes(): Hono {
return new Hono()
.get('/global/favorite/skills', async c => {
try {
const items = await listFavoriteItems('skill')
const type = c.req.query('type') as FavoriteItemType | undefined
const items = await listFavoriteItems(type)
return c.json({ success: true, items })
} catch (error) {
const message = error instanceof Error ? error.message : String(error)