import type { Metadata } from "next"; import { notFound } from "next/navigation"; import { PageHeader } from "@/components/page-header"; import { listMemberOptions } from "@/features/accounts/service"; import { hasHouseholdRole } from "@/features/households/roles"; import { TransactionsView } from "@/features/transactions/components/transactions-view"; import { getTransactionFormOptions, listTransactions } from "@/features/transactions/service"; import { tr } from "@/i18n/tr"; import { requireActiveHousehold } from "@/lib/dal"; import { transactionFilterSchema } from "@/shared/schemas/transaction"; export const metadata: Metadata = { title: tr.transactions.title }; export default async function TransactionsPage({ searchParams }: PageProps<"/islemler">) { const { user, household } = await requireActiveHousehold("viewer"); const params = await searchParams; // Yalnızca tekil string değerler (dizi parametreleri yok sayılır). const raw = Object.fromEntries( Object.entries(params).filter( (e): e is [string, string] => typeof e[1] === "string" && e[1] !== "", ), ); const filters = transactionFilterSchema.parse(raw); const [data, options, members] = await Promise.all([ listTransactions(user.id, household.id, filters), getTransactionFormOptions(user.id, household.id), listMemberOptions(user.id, household.id), ]); if (!data || !options || !members) notFound(); return ( <> ); }