2024-04-30 11:39:16 +02:00
|
|
|
import { db } from "bridge-common";
|
|
|
|
|
import { serviceConfig, Edit } from "bridge-ui";
|
2024-04-26 14:31:33 +02:00
|
|
|
|
|
|
|
|
type PageProps = {
|
2024-04-26 15:49:58 +02:00
|
|
|
params: { segment: string[] };
|
2024-04-26 14:31:33 +02:00
|
|
|
};
|
|
|
|
|
|
2024-04-26 15:49:58 +02:00
|
|
|
export default async function Page({ params: { segment } }: PageProps) {
|
|
|
|
|
const service = segment[0];
|
|
|
|
|
const id = segment?.[1];
|
2024-04-26 14:31:33 +02:00
|
|
|
|
|
|
|
|
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} />;
|
|
|
|
|
}
|