feat(ST-zyb6qlnn): UserQuestions server-side ophalen en als prop doorzenden
- app/(app)/ideas/[id]/page.tsx: userQuestion.findMany + DTO-mapping - components/ideas/idea-detail-layout.tsx: IdeaUserQuestionDto type + userQuestions prop toegevoegd aan Props interface en component-signature Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a6c57eba15
commit
99ae2d7e8f
2 changed files with 24 additions and 0 deletions
|
|
@ -69,6 +69,13 @@ export default async function IdeaDetailPage({ params, searchParams }: PageProps
|
|||
},
|
||||
})
|
||||
|
||||
const userQuestionsRaw = await prisma.userQuestion.findMany({
|
||||
where: { idea_id: id },
|
||||
orderBy: { created_at: 'asc' },
|
||||
take: 100,
|
||||
select: { id: true, question: true, answer: true, status: true, created_at: true },
|
||||
})
|
||||
|
||||
return (
|
||||
<IdeaDetailLayout
|
||||
idea={ideaToDto(idea)}
|
||||
|
|
@ -91,6 +98,13 @@ export default async function IdeaDetailPage({ params, searchParams }: PageProps
|
|||
created_at: q.created_at.toISOString(),
|
||||
expires_at: q.expires_at.toISOString(),
|
||||
}))}
|
||||
userQuestions={userQuestionsRaw.map((uq) => ({
|
||||
id: uq.id,
|
||||
question: uq.question,
|
||||
answer: uq.answer,
|
||||
status: uq.status as 'pending' | 'answered',
|
||||
created_at: uq.created_at.toISOString(),
|
||||
}))}
|
||||
isDemo={session.isDemo ?? false}
|
||||
initialTab={tab ?? 'idee'}
|
||||
/>
|
||||
|
|
|
|||
|
|
@ -71,6 +71,14 @@ interface ProductOption {
|
|||
repo_url: string | null
|
||||
}
|
||||
|
||||
export interface IdeaUserQuestionDto {
|
||||
id: string
|
||||
question: string
|
||||
answer: string | null
|
||||
status: 'pending' | 'answered'
|
||||
created_at: string
|
||||
}
|
||||
|
||||
interface Props {
|
||||
idea: IdeaDto
|
||||
grill_md: string | null
|
||||
|
|
@ -78,6 +86,7 @@ interface Props {
|
|||
products: ProductOption[]
|
||||
logs: IdeaLog[]
|
||||
questions: IdeaQuestion[]
|
||||
userQuestions: IdeaUserQuestionDto[]
|
||||
isDemo: boolean
|
||||
initialTab: string
|
||||
}
|
||||
|
|
@ -89,6 +98,7 @@ export function IdeaDetailLayout({
|
|||
products,
|
||||
logs,
|
||||
questions,
|
||||
userQuestions,
|
||||
isDemo,
|
||||
initialTab,
|
||||
}: Props) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue