2024-06-05 08:52:41 +02:00
|
|
|
import { db } from "@link-stack/bridge-common";
|
|
|
|
|
import { serviceConfig, Edit } from "@link-stack/bridge-ui";
|
2024-05-09 07:42:44 +02:00
|
|
|
|
|
|
|
|
type PageProps = {
|
2025-11-21 14:55:28 +01:00
|
|
|
params: Promise<{ segment: string[] }>;
|
2024-05-09 07:42:44 +02:00
|
|
|
};
|
|
|
|
|
|
2025-11-21 14:55:28 +01:00
|
|
|
export default async function Page({ params }: PageProps) {
|
|
|
|
|
const { segment } = await params;
|
2024-05-09 07:42:44 +02:00
|
|
|
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 <Edit service={service} row={row} />;
|
|
|
|
|
}
|