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

Function insertNote

packages/core/src/db/note-queries.ts:71–92  ·  view source on GitHub ↗
(note: Note)

Source from the content-addressed store, hash-verified

69}
70
71export async function insertNote(note: Note): Promise<void> {
72 const database = await getDB();
73 const deviceId = await getDeviceId();
74 const syncVersion = await nextSyncVersion(database, "notes");
75 await database.execute(
76 "INSERT INTO notes (id, book_id, highlight_id, cfi, title, content, chapter_title, tags, created_at, updated_at, sync_version, last_modified_by) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
77 [
78 note.id,
79 note.bookId,
80 note.highlightId || null,
81 note.cfi || null,
82 note.title,
83 note.content,
84 note.chapterTitle || null,
85 JSON.stringify(note.tags),
86 note.createdAt,
87 note.updatedAt,
88 syncVersion,
89 deviceId,
90 ],
91 );
92}
93
94export async function updateNote(id: string, updates: Partial<Note>): Promise<void> {
95 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