Import drizzle replacing prisma

Signed-off-by: Arthur DANJOU <arthurdanjou@outlook.fr>
This commit is contained in:
2024-04-20 00:03:10 +02:00
parent a7f0a635ec
commit c6ba8c791b
108 changed files with 2367 additions and 1554 deletions

20
server/api/talents.get.ts Normal file
View File

@@ -0,0 +1,20 @@
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)
)
})