diff --git a/build/server/main.js b/build/server/main.js index a56b184..b6737d5 100644 --- a/build/server/main.js +++ b/build/server/main.js @@ -1319,6 +1319,7 @@ const getAllTags = (db) => { const query = ` select c.id, c.slug, c.title, count(*) as total from categories c inner join image_x_category ixc on c.id = ixc.category_id +inner join images i on i.id = ixc.image_id group by c.id order by total desc;`; return db._getMany(query).map(row => ({ id: parseInt(row.id, 10) || 0, diff --git a/src/server/Images.ts b/src/server/Images.ts index 7733d77..90889bc 100644 --- a/src/server/Images.ts +++ b/src/server/Images.ts @@ -76,6 +76,7 @@ const getAllTags = (db: Db): Tag[] => { const query = ` select c.id, c.slug, c.title, count(*) as total from categories c inner join image_x_category ixc on c.id = ixc.category_id +inner join images i on i.id = ixc.image_id group by c.id order by total desc;` return db._getMany(query).map(row => ({ id: parseInt(row.id, 10) || 0,