diff --git a/cmd/backend/articles_authors.go b/cmd/backend/articles_authors.go index d5b89f5..0f4ef9e 100644 --- a/cmd/backend/articles_authors.go +++ b/cmd/backend/articles_authors.go @@ -43,8 +43,8 @@ func (db *DB) GetArticleAuthors(c *Config, articleID int64) ([]*User, error) { query := ` SELECT u.id FROM articles a - INNER JOIN articles_tags at ON a.id = at.article_id - INNER JOIN users u ON at.author_id = u.id + INNER JOIN articles_authors aa ON a.id = aa.article_id + INNER JOIN users u ON aa.author_id = u.id WHERE a.id = ? ` rows, err := db.Query(query, articleID) diff --git a/cmd/backend/articles_contributors.go b/cmd/backend/articles_contributors.go index 2f3da69..696c606 100644 --- a/cmd/backend/articles_contributors.go +++ b/cmd/backend/articles_contributors.go @@ -43,8 +43,8 @@ func (db *DB) GetArticleContributors(c *Config, articleID int64) ([]*User, error query := ` SELECT u.id FROM articles a - INNER JOIN articles_tags at ON a.id = at.article_id - INNER JOIN users u ON at.contributor_id = u.id + INNER JOIN articles_contributors ac ON a.id = ac.article_id + INNER JOIN users u ON ac.contributor_id = u.id WHERE a.id = ? ` rows, err := db.Query(query, articleID) diff --git a/cmd/backend/articles_tags.go b/cmd/backend/articles_tags.go index 72e7273..0cc9652 100644 --- a/cmd/backend/articles_tags.go +++ b/cmd/backend/articles_tags.go @@ -43,8 +43,8 @@ func (db *DB) GetArticleTags(articleID int64) ([]*Tag, error) { query := ` SELECT t.id, t.name FROM articles a - INNER JOIN articles_tags at ON a.id = at.article_id - INNER JOIN tags t ON at.tag_id = t.id + INNER JOIN articles_tags at ON a.id = at.article_id + INNER JOIN tags t ON at.tag_id = t.id WHERE a.id = ? ` rows, err := db.Query(query, articleID)