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,
Excerpt: body.Post.Current.Excerpt,
HtmlMarkup: body.Post.Current.HtmlMarkup,
PrimaryTag: body.Post.Current.PrimaryTag,
PublishedAt: float64(time.Unix()),
}
services.ImportArticle(newArticle)

View File

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

View File

@ -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"`
}

View File

@ -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"`
}

View File

@ -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)