ForumPostEdit

final class ForumPostEdit : Model

When a ForumPost is edited, a ForumPostEdit is created and associated with the post.

This is done for accountability purposes and the data collected is intended to be viewable only by users with an access level of .moderator or above.

See

See Also: ForumPostModerationData the DTO for returning data moderators need to moderate ForumPosts. Specifically, see the PostEditLogData sub-struct.

See

See Also: CreateForumPostEditSchema the Migration for creating the ForumPostEdit table in the database.

Properties

  • id

    The edit’s ID.

    Declaration

    Swift

    @ID
    var id: UUID?
  • The previous text of the post.

    Declaration

    Swift

    @Field
    var postText: String
  • The previous images, if any.

    Declaration

    Swift

    @OptionalField
    var images: [String]?
  • Timestamp of the model’s creation, set automatically.

    Declaration

    Swift

    @Timestamp
    var createdAt: Date?

Relations

Initialization

  • Declaration

    Swift

    init()
  • Initializes a new ForumEdit with the current contents of a post.. Call on the post BEFORE editing it to save previous contents.

    Declaration

    Swift

    init(post: ForumPost, editorID: UUID) throws

    Parameters

    post

    The ForumPost that will be edited.