diff --git a/pkg/internal/http/api/stories_api.go b/pkg/internal/http/api/stories_api.go index e9fd136..b9a3fcd 100644 --- a/pkg/internal/http/api/stories_api.go +++ b/pkg/internal/http/api/stories_api.go @@ -44,6 +44,7 @@ func createStory(c *fiber.Ctx) error { IsDraft bool `json:"is_draft"` ReplyTo *uint `json:"reply_to"` RepostTo *uint `json:"repost_to"` + Poll *uint `json:"poll"` } if err := exts.BindAndValidate(c, &data); err != nil { @@ -82,6 +83,7 @@ func createStory(c *fiber.Ctx) error { VisibleUsers: data.VisibleUsers, InvisibleUsers: data.InvisibleUsers, PublisherID: publisher.ID, + PollID: data.Poll, } if item.PublishedAt == nil { @@ -149,6 +151,7 @@ func editStory(c *fiber.Ctx) error { InvisibleUsers []uint `json:"invisible_users_list"` Visibility *int8 `json:"visibility"` IsDraft bool `json:"is_draft"` + Poll *uint `json:"poll"` } if err := exts.BindAndValidate(c, &data); err != nil { @@ -206,6 +209,7 @@ func editStory(c *fiber.Ctx) error { item.PublishedUntil = data.PublishedUntil item.VisibleUsers = data.VisibleUsers item.InvisibleUsers = data.InvisibleUsers + item.PollID = data.Poll // Preload publisher data item.Publisher = publisher diff --git a/pkg/internal/models/posts.go b/pkg/internal/models/posts.go index f58238c..3c0baee 100644 --- a/pkg/internal/models/posts.go +++ b/pkg/internal/models/posts.go @@ -58,6 +58,9 @@ type Post struct { TotalUpvote int `json:"total_upvote"` TotalDownvote int `json:"total_downvote"` + PollID *uint `json:"poll_id"` + Poll *Poll `json:"poll"` + RealmID *uint `json:"realm_id"` Realm *authm.Realm `json:"realm" gorm:"-"`