(id: number)
| 22 | } |
| 23 | |
| 24 | export 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 | |
| 42 | export async function getBookmarkBySlug(slug: string): Promise<(Bookmark & { category: Category | null }) | null> { |
| 43 | const results = await db |
nothing calls this directly
no outgoing calls
no test coverage detected