The best way to control Claude Code, Codex and more from any computer or phone

main
ts 20 lines 487 Bytes
Raw
1 import { getDb } from "./db";
2
3 export async function getLatestPosts(limit = 10) {
4 const db = getDb();
5 const runtime = db.runtime();
6
7 return runtime.query(
8 db.sql.public.post
9 .select("title", "excerpt")
10 .orderBy("createdAt", { direction: "desc" })
11 .limit(limit)
12 .build(),
13 );
14 }
15
16 export async function checkDatabaseReady() {
17 const db = getDb();
18 const runtime = db.runtime();
19 await runtime.query(db.sql.public.user.select("id").limit(1).build());
20 }