Skip to content

Commit

Permalink
chore: simplify sql
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 ab6a159 commit 218230a
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions server/src/services/feed.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { and, count, desc, eq, like, or } from "drizzle-orm";
import Elysia, { t } from "elysia";
import { XMLParser } from "fast-xml-parser";
import {and, count, desc, eq, like, or} from "drizzle-orm";
import Elysia, {t} from "elysia";
import {XMLParser} from "fast-xml-parser";
import html2md from 'html-to-md';
import type { DB } from "../_worker";
import { feeds, visits } from "../db/schema";
import { setup } from "../setup";
import { ClientConfig, PublicCache } from "../utils/cache";
import { getDB } from "../utils/di";
import { extractImage } from "../utils/image";
import { bindTagToPost } from "./tag";
import type {DB} from "../_worker";
import {feeds, visits} from "../db/schema";
import {setup} from "../setup";
import {ClientConfig, PublicCache} from "../utils/cache";
import {getDB} from "../utils/di";
import {extractImage} from "../utils/image";
import {bindTagToPost} from "./tag";

export function FeedService() {
const db: DB = getDB();
Expand Down Expand Up @@ -326,8 +326,7 @@ export function FeedService() {
const searchKeyword = `%${keyword}%`;
const where = or(like(feeds.title, searchKeyword),
like(feeds.content, searchKeyword),
like(feeds.summary, searchKeyword),
like(feeds.alias, searchKeyword));
like(feeds.summary, searchKeyword));
const feed_list = (await cache.getOrSet(cacheKey, () => db.query.feeds.findMany({
where: admin ? where : and(where, eq(feeds.draft, 0)),
columns: admin ? undefined : {
Expand Down

0 comments on commit 218230a

Please sign in to comment.