Skip to content

Commit

Permalink
chore: simplify sql4
Browse files Browse the repository at this point in the history
Signed-off-by: Xeu <[email protected]>
  • Loading branch information
OXeu committed Dec 3, 2024
1 parent cace53f commit 4f251dc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/src/services/feed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4f251dc

Please sign in to comment.