|
1 |
| -import { and, count, desc, eq, like, or } from "drizzle-orm"; |
2 |
| -import Elysia, { t } from "elysia"; |
3 |
| -import { XMLParser } from "fast-xml-parser"; |
| 1 | +import {and, count, desc, eq, like, or} from "drizzle-orm"; |
| 2 | +import Elysia, {t} from "elysia"; |
| 3 | +import {XMLParser} from "fast-xml-parser"; |
4 | 4 | import html2md from 'html-to-md';
|
5 |
| -import type { DB } from "../_worker"; |
6 |
| -import { feeds, visits } from "../db/schema"; |
7 |
| -import { setup } from "../setup"; |
8 |
| -import { ClientConfig, PublicCache } from "../utils/cache"; |
9 |
| -import { getDB } from "../utils/di"; |
10 |
| -import { extractImage } from "../utils/image"; |
11 |
| -import { bindTagToPost } from "./tag"; |
| 5 | +import type {DB} from "../_worker"; |
| 6 | +import {feeds, visits} from "../db/schema"; |
| 7 | +import {setup} from "../setup"; |
| 8 | +import {ClientConfig, PublicCache} from "../utils/cache"; |
| 9 | +import {getDB} from "../utils/di"; |
| 10 | +import {extractImage} from "../utils/image"; |
| 11 | +import {bindTagToPost} from "./tag"; |
12 | 12 |
|
13 | 13 | export function FeedService() {
|
14 | 14 | const db: DB = getDB();
|
@@ -324,12 +324,12 @@ export function FeedService() {
|
324 | 324 | }
|
325 | 325 | const cacheKey = `search_${keyword}`;
|
326 | 326 | const searchKeyword = `%${keyword}%`;
|
327 |
| - const where = or(like(feeds.title, searchKeyword), |
| 327 | + const whereClause = or(like(feeds.title, searchKeyword), |
328 | 328 | like(feeds.content, searchKeyword),
|
329 |
| - like(feeds.summary, searchKeyword), |
330 |
| - like(feeds.alias, searchKeyword)); |
| 329 | + like(feeds.summary, searchKeyword), |
| 330 | + like(feeds.alias, searchKeyword)); |
331 | 331 | const feed_list = (await cache.getOrSet(cacheKey, () => db.query.feeds.findMany({
|
332 |
| - where: admin ? where : and(where, eq(feeds.draft, 0)), |
| 332 | + where: admin ? whereClause : and(whereClause, eq(feeds.draft, 0)), |
333 | 333 | columns: admin ? undefined : {
|
334 | 334 | draft: false,
|
335 | 335 | listed: false
|
|
0 commit comments