From ef547e9825545ef548b27b8c051beb97f73a7307 Mon Sep 17 00:00:00 2001 From: Zutatensuppe Date: Thu, 3 Jun 2021 23:49:03 +0200 Subject: [PATCH] add join to images --- build/server/main.js | 1 + src/server/Images.ts | 1 + 2 files changed, 2 insertions(+) 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,