feat(ideas): resolve active_product_id en geef door aan IdeaList
Haalt active_product_id op via prisma.user.findUnique en resolveert het tegen de al opgehaalde toegankelijke productenlijst (AC4). Geeft het resultaat als prop door aan IdeaList in plaats van hardcoded null. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2150038066
commit
0a06b1dc74
1 changed files with 11 additions and 1 deletions
|
|
@ -32,6 +32,16 @@ export default async function IdeasPage() {
|
||||||
select: { id: true, name: true, repo_url: true },
|
select: { id: true, name: true, repo_url: true },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const user = await prisma.user.findUnique({
|
||||||
|
where: { id: session.userId },
|
||||||
|
select: { active_product_id: true },
|
||||||
|
})
|
||||||
|
|
||||||
|
const activeProductId =
|
||||||
|
user?.active_product_id && products.some((p) => p.id === user.active_product_id)
|
||||||
|
? user.active_product_id
|
||||||
|
: null
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="p-6 max-w-5xl mx-auto w-full">
|
<div className="p-6 max-w-5xl mx-auto w-full">
|
||||||
<header className="mb-6 flex items-baseline justify-between">
|
<header className="mb-6 flex items-baseline justify-between">
|
||||||
|
|
@ -45,7 +55,7 @@ export default async function IdeasPage() {
|
||||||
ideas={ideas.map((i) => ideaToDto(i))}
|
ideas={ideas.map((i) => ideaToDto(i))}
|
||||||
products={products}
|
products={products}
|
||||||
isDemo={session.isDemo ?? false}
|
isDemo={session.isDemo ?? false}
|
||||||
activeProductId={null}
|
activeProductId={activeProductId}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue