MCPcopy Create free account
hub / github.com/9d8dev/directory / getAllBookmarks

Function getAllBookmarks

lib/data.ts:8–18  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

6export type Category = typeof categories.$inferSelect;
7
8export async function getAllBookmarks(): Promise<(Bookmark & { category: Category | null })[]> {
9 const results = await db
10 .select()
11 .from(bookmarks)
12 .leftJoin(categories, eq(bookmarks.categoryId, categories.id));
13
14 return results.map(row => ({
15 ...row.bookmarks,
16 category: row.categories,
17 }));
18}
19
20export async function getAllCategories(): Promise<Category[]> {
21 return await db.select().from(categories);

Callers 3

sitemapFunction · 0.90
HomeFunction · 0.90
AdminPageFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected