From e77fabd25ed1e85714bd62bc5b98abd8a15cb958 Mon Sep 17 00:00:00 2001 From: Damillora Date: Sat, 8 May 2021 03:18:17 +0700 Subject: [PATCH] Remove primary tag from database --- pkg/app/routes.go | 1 - pkg/database/database.go | 4 ---- pkg/models/article.go | 3 --- pkg/models/postresult.go | 1 - pkg/services/article.go | 3 +-- 5 files changed, 1 insertion(+), 11 deletions(-) diff --git a/pkg/app/routes.go b/pkg/app/routes.go index 5f9826d..6c8c10d 100644 --- a/pkg/app/routes.go +++ b/pkg/app/routes.go @@ -53,7 +53,6 @@ func Webhook(c *gin.Context) { Slug: body.Post.Current.Slug, Excerpt: body.Post.Current.Excerpt, HtmlMarkup: body.Post.Current.HtmlMarkup, - PrimaryTag: body.Post.Current.PrimaryTag, PublishedAt: float64(time.Unix()), } services.ImportArticle(newArticle) diff --git a/pkg/database/database.go b/pkg/database/database.go index 6f3386a..765bc60 100644 --- a/pkg/database/database.go +++ b/pkg/database/database.go @@ -46,10 +46,6 @@ func CreateDatabaseSchema() { Name: "html", Type: "string", }, - { - Name: "primary_tag", - Type: "string", - }, { Name: "published_at", Type: "int64", diff --git a/pkg/models/article.go b/pkg/models/article.go index d2a7a33..cba35de 100644 --- a/pkg/models/article.go +++ b/pkg/models/article.go @@ -7,7 +7,6 @@ type Article struct { Slug string `json:"slug"` Excerpt string `json:"excerpt"` HtmlMarkup string `json:"html"` - PrimaryTag string `json:"primary_tag"` PublishedAt float64 `json:"published_at"` } @@ -18,7 +17,6 @@ type ArticleCreateModel struct { Slug string `json:"slug"` Excerpt string `json:"excerpt"` HtmlMarkup string `json:"html"` - PrimaryTag string `json:"primary_tag"` PublishedAt float64 `json:"published_at"` } @@ -28,6 +26,5 @@ type ArticleSearchResult struct { Slug string `json:"slug"` Excerpt string `json:"excerpt"` HtmlMarkup string `json:"html"` - PrimaryTag string `json:"primary_tag"` PublishedAt string `json:"published_at"` } diff --git a/pkg/models/postresult.go b/pkg/models/postresult.go index 305283b..8a6503d 100644 --- a/pkg/models/postresult.go +++ b/pkg/models/postresult.go @@ -14,6 +14,5 @@ type WebhookPost struct { Slug string `json:"slug"` Excerpt string `json:"excerpt"` HtmlMarkup string `json:"html"` - PrimaryTag string `json:"primary_tag"` PublishedAt string `json:"published_at"` } diff --git a/pkg/services/article.go b/pkg/services/article.go index f34d519..d6ce619 100644 --- a/pkg/services/article.go +++ b/pkg/services/article.go @@ -19,7 +19,7 @@ func SearchArticles(q string, page int) (SearchResult, error) { perPage := 10 searchParameters := &api.SearchCollectionParams{ Q: q, - QueryBy: []string{"title","slug","primary_tag","excerpt","html"}, + QueryBy: []string{"title", "slug", "primary_tag", "excerpt", "html"}, Page: &page, PerPage: &perPage, } @@ -36,7 +36,6 @@ func SearchArticles(q string, page int) (SearchResult, error) { Url: hit.Document["url"].(string), Slug: hit.Document["slug"].(string), Excerpt: hit.Document["excerpt"].(string), - HtmlMarkup: hit.Document["html"].(string), PublishedAt: time.Unix(int64(hit.Document["published_at"].(float64)), 0).String(), } articles = append(articles, article)