소스 검색

Add updateDocument() helper to store.ts

Add new helper function to update document hash and title simultaneously.
This is useful when file content changes but the path stays the same.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Tobi Lutke 5 달 전
부모
커밋
57550542aa
1개의 변경된 파일15개의 추가작업 그리고 0개의 파일을 삭제
  1. 15 0
      store.ts

+ 15 - 0
store.ts

@@ -1101,6 +1101,21 @@ export function updateDocumentTitle(
     .run(title, modifiedAt, documentId);
 }
 
+/**
+ * Update an existing document's hash, title, and modified_at timestamp.
+ * Used when content changes but the file path stays the same.
+ */
+export function updateDocument(
+  db: Database,
+  documentId: number,
+  title: string,
+  hash: string,
+  modifiedAt: string
+): void {
+  db.prepare(`UPDATE documents SET title = ?, hash = ?, modified_at = ? WHERE id = ?`)
+    .run(title, hash, modifiedAt, documentId);
+}
+
 /**
  * Deactivate a document (mark as inactive but don't delete).
  */