Skip to content

Commit

Permalink
fix(ipns): remove unused query on "Article.slug"
Browse files Browse the repository at this point in the history
  • Loading branch information
gitwoz committed Oct 31, 2024
1 parent 7710f76 commit 96fbced
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,9 @@ LIMIT ${take} OFFSET ${skip};`
return sqlRO`-- check latest articles' author ipns_key
SELECT u2.user_name, u2.display_name, GREATEST(ul.last_at ::date, u2.last_seen ::date) AS last_seen,
count_articles, ipns_key, last_data_hash AS top_dir_data_hash, last_published, a.*, avn.title,
concat('https://matters.town/@', u2.user_name, '/', a.id, '-', a.slug) AS last_article_url,
priv_key_pem, priv_key_name
FROM (
SELECT DISTINCT ON (author_id) author_id, id, slug, summary, data_hash AS last_article_data_hash, media_hash, created_at AS last_article_published
SELECT DISTINCT ON (author_id) author_id, id, summary, data_hash AS last_article_data_hash, media_hash, created_at AS last_article_published
FROM article
WHERE state IN ('active')
AND author_id NOT IN (SELECT user_id FROM user_restriction) -- skip restricted authors
Expand Down Expand Up @@ -516,7 +515,7 @@ RETURNING * ;`

queryArticlesByUuid(uuids: string[]) {
return sqlRO`
SELECT a.id, avn.title, a.slug, avn.data_hash, avn.media_hash, a.created_at
SELECT a.id, avn.title, avn.data_hash, avn.media_hash, a.created_at
FROM article a
LEFT JOIN article_version_newest avn ON a.id = avn.article_id
WHERE a.uuid =ANY(${uuids})
Expand Down

0 comments on commit 96fbced

Please sign in to comment.