Remove primary tag from database

This commit is contained in:
Damillora 2021-05-08 03:18:17 +07:00
parent c7ff45976f
commit e77fabd25e
5 changed files with 1 additions and 11 deletions

View File

@ -53,7 +53,6 @@ func Webhook(c *gin.Context) {
Slug: body.Post.Current.Slug, Slug: body.Post.Current.Slug,
Excerpt: body.Post.Current.Excerpt, Excerpt: body.Post.Current.Excerpt,
HtmlMarkup: body.Post.Current.HtmlMarkup, HtmlMarkup: body.Post.Current.HtmlMarkup,
PrimaryTag: body.Post.Current.PrimaryTag,
PublishedAt: float64(time.Unix()), PublishedAt: float64(time.Unix()),
} }
services.ImportArticle(newArticle) services.ImportArticle(newArticle)

View File

@ -46,10 +46,6 @@ func CreateDatabaseSchema() {
Name: "html", Name: "html",
Type: "string", Type: "string",
}, },
{
Name: "primary_tag",
Type: "string",
},
{ {
Name: "published_at", Name: "published_at",
Type: "int64", Type: "int64",

View File

@ -7,7 +7,6 @@ type Article struct {
Slug string `json:"slug"` Slug string `json:"slug"`
Excerpt string `json:"excerpt"` Excerpt string `json:"excerpt"`
HtmlMarkup string `json:"html"` HtmlMarkup string `json:"html"`
PrimaryTag string `json:"primary_tag"`
PublishedAt float64 `json:"published_at"` PublishedAt float64 `json:"published_at"`
} }
@ -18,7 +17,6 @@ type ArticleCreateModel struct {
Slug string `json:"slug"` Slug string `json:"slug"`
Excerpt string `json:"excerpt"` Excerpt string `json:"excerpt"`
HtmlMarkup string `json:"html"` HtmlMarkup string `json:"html"`
PrimaryTag string `json:"primary_tag"`
PublishedAt float64 `json:"published_at"` PublishedAt float64 `json:"published_at"`
} }
@ -28,6 +26,5 @@ type ArticleSearchResult struct {
Slug string `json:"slug"` Slug string `json:"slug"`
Excerpt string `json:"excerpt"` Excerpt string `json:"excerpt"`
HtmlMarkup string `json:"html"` HtmlMarkup string `json:"html"`
PrimaryTag string `json:"primary_tag"`
PublishedAt string `json:"published_at"` PublishedAt string `json:"published_at"`
} }

View File

@ -14,6 +14,5 @@ type WebhookPost struct {
Slug string `json:"slug"` Slug string `json:"slug"`
Excerpt string `json:"excerpt"` Excerpt string `json:"excerpt"`
HtmlMarkup string `json:"html"` HtmlMarkup string `json:"html"`
PrimaryTag string `json:"primary_tag"`
PublishedAt string `json:"published_at"` PublishedAt string `json:"published_at"`
} }

View File

@ -19,7 +19,7 @@ func SearchArticles(q string, page int) (SearchResult, error) {
perPage := 10 perPage := 10
searchParameters := &api.SearchCollectionParams{ searchParameters := &api.SearchCollectionParams{
Q: q, Q: q,
QueryBy: []string{"title","slug","primary_tag","excerpt","html"}, QueryBy: []string{"title", "slug", "primary_tag", "excerpt", "html"},
Page: &page, Page: &page,
PerPage: &perPage, PerPage: &perPage,
} }
@ -36,7 +36,6 @@ func SearchArticles(q string, page int) (SearchResult, error) {
Url: hit.Document["url"].(string), Url: hit.Document["url"].(string),
Slug: hit.Document["slug"].(string), Slug: hit.Document["slug"].(string),
Excerpt: hit.Document["excerpt"].(string), Excerpt: hit.Document["excerpt"].(string),
HtmlMarkup: hit.Document["html"].(string),
PublishedAt: time.Unix(int64(hit.Document["published_at"].(float64)), 0).String(), PublishedAt: time.Unix(int64(hit.Document["published_at"].(float64)), 0).String(),
} }
articles = append(articles, article) articles = append(articles, article)