mirror of
https://github.com/ArthurDanjou/website.git
synced 2026-01-14 20:19:35 +01:00
@@ -1,20 +1,20 @@
|
||||
export default defineEventHandler(async (event) => {
|
||||
const { favorite, category } = getQuery(event)
|
||||
const { favorite, category } = getQuery(event)
|
||||
|
||||
const talents = await useDB().query.talents
|
||||
.findMany({
|
||||
orderBy: [asc(tables.talents.id)],
|
||||
with: {
|
||||
talentCategories: {
|
||||
with: {
|
||||
category: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
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),
|
||||
)
|
||||
return talents.filter(talent =>
|
||||
(category === 'all' || talent.talentCategories.some(cat => cat.category.slug === category))
|
||||
&& (favorite === 'false' || talent.favorite),
|
||||
)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user