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

Function getBookmarkById

lib/data.ts:24–40  ·  view source on GitHub ↗
(id: number)

Source from the content-addressed store, hash-verified

22}
23
24export async function getBookmarkById(id: number): Promise<(Bookmark & { category: Category | null }) | null> {
25 const results = await db
26 .select()
27 .from(bookmarks)
28 .leftJoin(categories, eq(bookmarks.categoryId, categories.id))
29 .where(eq(bookmarks.id, id))
30 .limit(1);
31
32 if (results.length === 0) {
33 return null;
34 }
35
36 return {
37 ...results[0].bookmarks,
38 category: results[0].categories,
39 };
40}
41
42export async function getBookmarkBySlug(slug: string): Promise<(Bookmark & { category: Category | null }) | null> {
43 const results = await db

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected