fix(news): restore publication flow and deduplicate dashboard friends
This commit is contained in:
1 parent
ef94646d60
commit
9b0ea2fb16
22 files changed
+638
-195
No files matched your search
@@ -1,7 +1,8 @@
|
||||
import { logger } from "@/lib/logger";
|
||||
import { cacheNews } from "@/lib/services/news-cache";
|
||||
import "server-only";
|
||||
|
||||
import { and, desc, eq, or, sql } from "drizzle-orm";
|
||||
import { cached } from "@/lib/cache";
|
||||
import { db, WebsiteArticles } from "@/lib/db";
|
||||
|
||||
export interface NewsListItem {
|
||||
@@ -32,7 +33,7 @@ const FETCH_LIMIT = 30;
|
||||
*/
|
||||
export async function getNewsList(limit: number): Promise<NewsListItem[]> {
|
||||
try {
|
||||
const rows = await cached<NewsListRow[]>(CACHE_KEY, TTL_MS, () =>
|
||||
const rows = await cacheNews<NewsListRow[]>(CACHE_KEY, TTL_MS, () =>
|
||||
db
|
||||
.select({
|
||||
slug: WebsiteArticles.slug,
|
||||
@@ -60,7 +61,8 @@ export async function getNewsList(limit: number): Promise<NewsListItem[]> {
|
||||
createdAt: a.createdAt ? new Date(a.createdAt) : null,
|
||||
}))
|
||||
.slice(0, limit);
|
||||
} catch {
|
||||
} catch (error) {
|
||||
logger.error("Public news query failed", { module: "news", error });
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user