Make initial News loading faster

This commit is contained in:
Bruno Bernardino
2025-10-01 14:17:39 +01:00
parent adde693585
commit 1dcbf529a3
4 changed files with 20 additions and 2 deletions

View File

@@ -214,6 +214,17 @@ export class ArticleModel {
return articles;
}
static async listUnread(userId: string) {
const articles = await db.query<NewsFeedArticle>(
sql`SELECT * FROM "bewcloud_news_feed_articles" WHERE "user_id" = $1 AND "is_read" = FALSE ORDER BY "article_date" DESC`,
[
userId,
],
);
return articles;
}
static async listByFeedId(feedId: string) {
const articles = await db.query<NewsFeedArticle>(
sql`SELECT * FROM "bewcloud_news_feed_articles" WHERE "feed_id" = $1 ORDER BY "article_date" DESC`,