⏪ Alias is back
This commit is contained in:
parent
6e14684539
commit
008d531855
@ -27,6 +27,7 @@ type Post struct {
|
||||
Type string `json:"type"`
|
||||
Body datatypes.JSONMap `json:"body"`
|
||||
Language string `json:"language"`
|
||||
Alias *string `json:"alias"`
|
||||
Tags []Tag `json:"tags" gorm:"many2many:post_tags"`
|
||||
Categories []Category `json:"categories" gorm:"many2many:post_categories"`
|
||||
Reactions []Reaction `json:"reactions"`
|
||||
|
@ -21,6 +21,7 @@ func createArticle(c *fiber.Ctx) error {
|
||||
user := c.Locals("user").(models.Account)
|
||||
|
||||
var data struct {
|
||||
Alias *string `json:"alias"`
|
||||
Title string `json:"title" validate:"required,max=1024"`
|
||||
Description *string `json:"description"`
|
||||
Content string `json:"content" validate:"required"`
|
||||
@ -54,6 +55,7 @@ func createArticle(c *fiber.Ctx) error {
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
item := models.Post{
|
||||
Alias: data.Alias,
|
||||
Type: models.PostTypeArticle,
|
||||
Body: bodyMapping,
|
||||
Language: services.DetectLanguage(data.Content),
|
||||
@ -103,6 +105,7 @@ func editArticle(c *fiber.Ctx) error {
|
||||
user := c.Locals("user").(models.Account)
|
||||
|
||||
var data struct {
|
||||
Alias *string `json:"alias"`
|
||||
Title string `json:"title" validate:"required,max=1024"`
|
||||
Description *string `json:"description"`
|
||||
Content string `json:"content" validate:"required"`
|
||||
@ -157,6 +160,7 @@ func editArticle(c *fiber.Ctx) error {
|
||||
rawBody, _ := jsoniter.Marshal(body)
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
item.Alias = data.Alias
|
||||
item.Body = bodyMapping
|
||||
item.Language = services.DetectLanguage(data.Content)
|
||||
item.Tags = data.Tags
|
||||
|
@ -21,6 +21,7 @@ func createStory(c *fiber.Ctx) error {
|
||||
user := c.Locals("user").(models.Account)
|
||||
|
||||
var data struct {
|
||||
Alias *string `json:"alias"`
|
||||
Title *string `json:"title"`
|
||||
Content string `json:"content" validate:"required,max=4096"`
|
||||
Location *string `json:"location"`
|
||||
@ -56,6 +57,7 @@ func createStory(c *fiber.Ctx) error {
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
item := models.Post{
|
||||
Alias: data.Alias,
|
||||
Type: models.PostTypeStory,
|
||||
Body: bodyMapping,
|
||||
Language: services.DetectLanguage(data.Content),
|
||||
@ -122,6 +124,7 @@ func editStory(c *fiber.Ctx) error {
|
||||
user := c.Locals("user").(models.Account)
|
||||
|
||||
var data struct {
|
||||
Alias *string `json:"alias"`
|
||||
Title *string `json:"title"`
|
||||
Content string `json:"content" validate:"required,max=4096"`
|
||||
Thumbnail *uint `json:"thumbnail"`
|
||||
@ -176,6 +179,7 @@ func editStory(c *fiber.Ctx) error {
|
||||
rawBody, _ := jsoniter.Marshal(body)
|
||||
_ = jsoniter.Unmarshal(rawBody, &bodyMapping)
|
||||
|
||||
item.Alias = data.Alias
|
||||
item.Body = bodyMapping
|
||||
item.Language = services.DetectLanguage(data.Content)
|
||||
item.Tags = data.Tags
|
||||
|
Loading…
Reference in New Issue
Block a user