debug: sample tokens in debug endpoint

This commit is contained in:
2026-06-13 12:39:04 +02:00
parent 1a93fc611d
commit cef01107cb

View File

@@ -59,13 +59,14 @@ router.delete('/:id', authenticate, (req, res) => {
res.json({ ok: true });
});
// Debug: Tabellenstatus prüfen
// Debug: Tabellenstatus + eigene Shares mit Token
router.get('/debug-table', (req, res) => {
try {
const exists = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='public_file_shares'").get();
const count = exists ? db.prepare('SELECT COUNT(*) as n FROM public_file_shares').get() : null;
const cols = exists ? db.pragma('table_info(public_file_shares)').map(c=>c.name) : [];
res.json({ exists: !!exists, count: count?.n, cols });
const sample = exists ? db.prepare('SELECT id, token, user_id, file_id, folder_id, expires_at, download_count FROM public_file_shares LIMIT 5').all() : [];
res.json({ exists: !!exists, count: count?.n, cols, sample });
} catch(e) { res.status(500).json({ error: e.message }); }
});