From 4f251dc2897da07ab013b1fa62f0319021299bfb Mon Sep 17 00:00:00 2001 From: Xeu Date: Wed, 4 Dec 2024 02:01:02 +0800 Subject: [PATCH] chore: simplify sql4 Signed-off-by: Xeu --- server/src/services/feed.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/src/services/feed.ts b/server/src/services/feed.ts index 031a939b..91f0b9e2 100644 --- a/server/src/services/feed.ts +++ b/server/src/services/feed.ts @@ -324,12 +324,12 @@ export function FeedService() { } const cacheKey = `search_${keyword}`; const searchKeyword = `%${keyword}%`; - const where = or(like(feeds.title, searchKeyword), + const whereClause = or(like(feeds.title, searchKeyword), like(feeds.content, searchKeyword), like(feeds.summary, searchKeyword), like(feeds.alias, searchKeyword)); const feed_list = (await cache.getOrSet(cacheKey, () => db.query.feeds.findMany({ - where: admin ? where : and(where, eq(feeds.draft, 0)), + where: admin ? whereClause : and(whereClause, eq(feeds.draft, 0)), columns: admin ? undefined : { draft: false, listed: false