diff --git a/pkg/internal/models/posts.go b/pkg/internal/models/posts.go index 15d28c1..bceb22d 100644 --- a/pkg/internal/models/posts.go +++ b/pkg/internal/models/posts.go @@ -28,6 +28,7 @@ type Post struct { RepostTo *Post `json:"repost_to" gorm:"foreignKey:RepostID"` Realm *Realm `json:"realm"` + EditedAt *time.Time `json:"edited_at"` PinnedAt *time.Time `json:"pinned_at"` IsDraft bool `json:"is_draft"` diff --git a/pkg/internal/services/posts.go b/pkg/internal/services/posts.go index bfd7346..6381440 100644 --- a/pkg/internal/services/posts.go +++ b/pkg/internal/services/posts.go @@ -226,6 +226,8 @@ func NewPost(user models.Account, item models.Post) (models.Post, error) { } } + item.EditedAt = lo.ToPtr(time.Now()) + if err := database.C.Save(&item).Error; err != nil { return item, err }