(highlight: Highlight)
| 150 | } |
| 151 | |
| 152 | export 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 | |
| 174 | export async function updateHighlight(id: string, updates: Partial<Highlight>): Promise<void> { |
| 175 | const database = await getDB(); |
no test coverage detected