#!/usr/bin/env node const sqlite3 = require('sqlite3').verbose(); const path = require('path'); // Connect to the database const dbPath = '/app/data/photo_sharing.db'; console.log(`Connecting to database at: ${dbPath}`); const db = new sqlite3.Database(dbPath, sqlite3.OPEN_READONLY, (err) => { if (err) { console.error('Error opening database:', err.message); process.exit(1); } console.log('Connected to the SQLite database.'); }); // Query for photos with IDs 1688 and 1689 where event_id = 12 const query = ` SELECT id, filename, path, thumbnail_path FROM photos WHERE id IN (1688, 1689) AND event_id = 12 `; console.log('\nExecuting query:', query); db.all(query, [], (err, rows) => { if (err) { console.error('Error executing query:', err.message); db.close(); process.exit(1); } console.log(`\nFound ${rows.length} photo(s):\n`); if (rows.length === 0) { console.log('No photos found matching the criteria.'); } else { rows.forEach((row) => { console.log('Photo ID:', row.id); console.log('Filename:', row.filename); console.log('Path:', row.path); console.log('Thumbnail Path:', row.thumbnail_path); console.log('---'); }); } // Close the database connection db.close((err) => { if (err) { console.error('Error closing database:', err.message); } else { console.log('\nDatabase connection closed.'); } }); });