ForumPostEdit

final class ForumPostEdit : Model, @unchecked Sendable

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

    @ForumPostEdit
    .ID var id: UUID? { get set }
  • The previous text of the post.

    Declaration

    Swift

    @ForumPostEdit
    .Field var postText: String { get set }
  • The previous images, if any.

    Declaration

    Swift

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

    Declaration

    Swift

    @ForumPostEdit
    .Timestamp var createdAt: Date? { get set }

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.