mirror of
https://github.com/ArthurDanjou/website.git
synced 2026-01-14 12:14:42 +01:00
21 lines
517 B
TypeScript
21 lines
517 B
TypeScript
export default defineEventHandler(async (event) => {
|
|
const { favorite, category } = getQuery(event)
|
|
|
|
const talents = await useDB().query.talents
|
|
.findMany({
|
|
orderBy: [asc(tables.talents.id)],
|
|
with: {
|
|
talentCategories: {
|
|
with: {
|
|
category: true
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
return talents.filter(talent =>
|
|
(category === 'all' || talent.talentCategories.some(cat => cat.category.slug === category))
|
|
&& (favorite === 'false' || talent.favorite)
|
|
)
|
|
})
|