{{ post?.title }}
-{{ post?.description }}
+{{ post?.title }}
+{{ post?.description }}
+{{ post?.author.nick }}
++ {{ post?.author.description ? post?.author.description : "No description yet." }} +
+diff --git a/pkg/services/posts.go b/pkg/services/posts.go index 25177c1..aa6a6f3 100644 --- a/pkg/services/posts.go +++ b/pkg/services/posts.go @@ -75,9 +75,11 @@ func (v *PostTypeContext) SortCreatedAt(order string) *PostTypeContext { func (v *PostTypeContext) GetViaAlias(alias string) (models.Feed, error) { var item models.Feed table := viper.GetString("database.prefix") + v.TableName + userTable := viper.GetString("database.prefix") + "accounts" if err := v.Tx. Table(table). Select("*, ? as model_type", v.ColumnName). + Joins(fmt.Sprintf("INNER JOIN %s AS author ON author_id = author.id", userTable)). Where("alias = ?", alias). First(&item).Error; err != nil { return item, err @@ -99,9 +101,11 @@ func (v *PostTypeContext) GetViaAlias(alias string) (models.Feed, error) { func (v *PostTypeContext) Get(id uint, noComments ...bool) (models.Feed, error) { var item models.Feed table := viper.GetString("database.prefix") + v.TableName + userTable := viper.GetString("database.prefix") + "accounts" if err := v.Tx. Table(table). Select("*, ? as model_type", v.ColumnName). + Joins(fmt.Sprintf("INNER JOIN %s AS author ON author_id = author.id", userTable)). Where("id = ?", id).First(&item).Error; err != nil { return item, err } diff --git a/pkg/views/src/components/posts/ArticleContent.vue b/pkg/views/src/components/posts/ArticleContent.vue index 7bfd373..65cd7ff 100644 --- a/pkg/views/src/components/posts/ArticleContent.vue +++ b/pkg/views/src/components/posts/ArticleContent.vue @@ -5,14 +5,16 @@
{{ post?.description }}
+{{ post?.description }}
+{{ post?.author.nick }}
++ {{ post?.author.description ? post?.author.description : "No description yet." }} +
+