28 lines
595 B
TypeScript
28 lines
595 B
TypeScript
import { db } from "@/app/_lib/database";
|
|
import { serviceConfig } from "@/app/_lib/config";
|
|
import { Detail } from "./_components/Detail";
|
|
|
|
type Props = {
|
|
params: { segment: string[] };
|
|
};
|
|
|
|
export default async function Page({ params: { segment } }: Props) {
|
|
const service = segment[0];
|
|
const id = segment?.[1];
|
|
|
|
if (!id) return null;
|
|
|
|
const {
|
|
[service]: { table },
|
|
} = serviceConfig;
|
|
|
|
const row = await db
|
|
.selectFrom(table)
|
|
.selectAll()
|
|
.where("id", "=", id)
|
|
.executeTakeFirst();
|
|
|
|
if (!row) return null;
|
|
|
|
return <Detail service={service} row={row} />;
|
|
}
|