Initialize client forms

This commit is contained in:
2026-09-17 07:22:20 +01:00
parent e0d105beb9
commit 90ee3debf0
28 changed files with 584 additions and 145 deletions
@@ -0,0 +1,43 @@
import type {
BUN_SQLITE_WGUI_CLIENTS,
BUN_SQLITE_WGUI_HOSTS,
} from "@/db/types/db";
import type { PagePropsType, PageQueryObject, TableType } from "@/src/types";
import BunSQLite from "@moduletrace/bun-sqlite";
import type { BunextPageServerFn } from "@moduletrace/bunext/types";
const server: BunextPageServerFn<PagePropsType> = async ({
req,
url,
query,
}) => {
const page_query = query as PageQueryObject;
const host_record_res = await BunSQLite.select<
BUN_SQLITE_WGUI_HOSTS,
TableType
>({ table: "hosts", targetId: page_query.host_id });
const host_clients = await BunSQLite.select<
BUN_SQLITE_WGUI_CLIENTS,
TableType
>({
table: "clients",
query: {
query: {
host_id: {
value: page_query.host_id,
},
},
},
});
return {
props: {
host: host_record_res.singleRes || null,
clients: host_clients.payload || null,
},
};
};
export default server;