diff --git a/lib/db-operations.js b/lib/db-operations.js index 3781c9c..3c0aa44 100644 --- a/lib/db-operations.js +++ b/lib/db-operations.js @@ -223,6 +223,15 @@ function getStats() { }; } +function getIndexStats() { + const db = getDb(); + return { + totalLists: db.prepare('SELECT COUNT(*) as count FROM awesome_lists').get().count, + totalRepositories: db.prepare('SELECT COUNT(*) as count FROM repositories').get().count, + totalReadmes: db.prepare('SELECT COUNT(*) as count FROM readmes').get().count + }; +} + // Random function getRandomRepository() { const db = getDb(); @@ -256,5 +265,6 @@ module.exports = { getSetting, setSetting, getStats, + getIndexStats, getRandomRepository };