✨ Detect language in controller layer
This commit is contained in:
@ -49,6 +49,7 @@ func createArticle(c *fiber.Ctx) error {
|
||||
item := models.Post{
|
||||
Type: models.PostTypeArticle,
|
||||
Body: bodyMapping,
|
||||
Language: services.DetectLanguage(data.Content),
|
||||
Tags: data.Tags,
|
||||
Categories: data.Categories,
|
||||
IsDraft: data.IsDraft,
|
||||
@ -117,6 +118,7 @@ func editArticle(c *fiber.Ctx) error {
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
item.Body = bodyMapping
|
||||
item.Language = services.DetectLanguage(data.Content)
|
||||
item.Tags = data.Tags
|
||||
item.Categories = data.Categories
|
||||
item.IsDraft = data.IsDraft
|
||||
|
@ -51,6 +51,7 @@ func createStory(c *fiber.Ctx) error {
|
||||
item := models.Post{
|
||||
Type: models.PostTypeStory,
|
||||
Body: bodyMapping,
|
||||
Language: services.DetectLanguage(data.Content),
|
||||
Tags: data.Tags,
|
||||
Categories: data.Categories,
|
||||
PublishedAt: data.PublishedAt,
|
||||
@ -137,6 +138,7 @@ func editStory(c *fiber.Ctx) error {
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
item.Body = bodyMapping
|
||||
item.Language = services.DetectLanguage(data.Content)
|
||||
item.Tags = data.Tags
|
||||
item.Categories = data.Categories
|
||||
item.PublishedAt = data.PublishedAt
|
||||
|
Reference in New Issue
Block a user