MCPcopy
hub / github.com/codedogQBY/ReadAny / insertHighlight

Function insertHighlight

packages/core/src/db/highlight-queries.ts:152–172  ·  view source on GitHub ↗
(highlight: Highlight)

Source from the content-addressed store, hash-verified

150}
151
152export async function insertHighlight(highlight: Highlight): Promise<void> {
153 const database = await getDB();
154 const deviceId = await getDeviceId();
155 const syncVersion = await nextSyncVersion(database, "highlights");
156 await database.execute(
157 "INSERT INTO highlights (id, book_id, cfi, text, color, note, chapter_title, created_at, updated_at, sync_version, last_modified_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
158 [
159 highlight.id,
160 highlight.bookId,
161 highlight.cfi,
162 highlight.text,
163 highlight.color,
164 highlight.note || null,
165 highlight.chapterTitle || null,
166 highlight.createdAt,
167 highlight.updatedAt,
168 syncVersion,
169 deviceId,
170 ],
171 );
172}
173
174export async function updateHighlight(id: string, updates: Partial<Highlight>): Promise<void> {
175 const database = await getDB();

Callers 1

Calls 4

getDBFunction · 0.90
getDeviceIdFunction · 0.90
nextSyncVersionFunction · 0.90
executeMethod · 0.65

Tested by

no test coverage detected