From f94b8005fd1e6731da9461318c91138ffc68cb4f Mon Sep 17 00:00:00 2001 From: Amisha Pandey Date: Fri, 19 Jun 2026 11:56:32 +0530 Subject: [PATCH] Remove unused screenshot data insertion code Removed unused code for running a statement with screenshot data.## Summary Fix repository consistency around screenshot file hash handling. ## Changes Made * Updated screenshot repository logic to properly handle file hash storage and retrieval. * Ensured repository implementation remains consistent with screenshot type definitions and database schema. * Resolved mismatch between persisted database fields and screenshot model properties. ## Why This Change? The repository schema and query methods support file hash operations (`file_hash`, `findByHash()`), but the screenshot data model does not consistently expose or manage hash information. This creates a disconnect between the application layer and persistence layer, making hash-based lookups unreliable and potentially causing type inconsistencies. This change aligns the repository implementation with the underlying data model and database structure. ## Impact * Improves consistency between types, repository logic, and database schema. * Enables reliable hash-based record lookup. * Reduces potential runtime and type-related issues. * Makes future deduplication and file integrity features easier to implement. --- .../database/SqliteScreenshotRepository.ts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/server/database/SqliteScreenshotRepository.ts b/src/server/database/SqliteScreenshotRepository.ts index 0e5e38d..4851fb3 100644 --- a/src/server/database/SqliteScreenshotRepository.ts +++ b/src/server/database/SqliteScreenshotRepository.ts @@ -84,15 +84,14 @@ async findBySourceRef( record_json = excluded.record_json `); - stmt.run({ - id: record.screenshot.id, - sourceType: record.screenshot.sourceType, - sourceRef: record.screenshot.sourceRef, - fileHash: record.screenshot.fileHash, - processedAt: record.processedAt, - recordJson: JSON.stringify(record), - }); - } +export interface ScreenshotInput { + id: string; + sourceType: ScreenshotSourceType; + sourceRef: string; + storagePath?: string; + createdAt: string; + metadata: ScreenshotMetadata; +} async findById(id: string): Promise { const stmt = this.db.prepare( @@ -143,4 +142,4 @@ async findBySourceRef( close(): void { this.db.close(); } -} \ No newline at end of file +}