Twarrt

final class Twarrt : Model, Searchable, @unchecked Sendable
extension Twarrt: ContentFilterable
extension Twarrt: Reportable

An individual post in the Twitarr stream. Posts must contain text content, and may also contain images.

Twarrts are content that can be quarantined or locked by moderators. A quarantined twarrt will have its contents replaced with a quarantine message, and will not have any images. A locked twarrt can only be modified by moderators. When edited, twarrts create edit records showing previous state for moderation purposes.

V2 of Twitarr (and, actual Twitter) have tweet replies that work as a directed acyclic graph. Any tweet can be created as a reply to an existing tweet, a tweet can have multiple direct reply tweets, and a tweet can be both a reply to another tweet and the target of other replies. V3 doesn’t work that way. A new twarrt replying to a twarrt not already in a Reply Group creates a Reply Group, and both the replied–to and reply twarrt have their replyGroup set to the ID of the replied-to twarrt. A reply to a twarrt already in a Reply Group gets added to the Reply Group.

This means that any twarrt that has a non-null replyGroup has a thread can can be retrieved. It also means that replies are one level deep–a reply to a reply is not considered differernt than a 2 replies to a single twarrt.

See

See Also: TwarrtData the DTO for returning basic data on Twarrts.

See

See Also: TwarrtDetailData the DTO for returning basic data on Twarrts.

See

See Also: PostData the DTO for creating or editing Twarrts.

See

See Also: CreateTwarrtSchema the Migration for creating the Twarrts table in the database.

Properties

  • id

    The twarrt’s ID.

    Declaration

    Swift

    @Twarrt
    .ID var id: Int? { get set }
  • The text content of the twarrt.

    Declaration

    Swift

    @Twarrt
    .Field var text: String { get set }
  • The filenames of any images for the post.

    Declaration

    Swift

    @Twarrt
    .OptionalField var images: [String]? { get set }
  • Moderators can set several statuses on twarrts that modify editability and visibility.

    Declaration

    Swift

    @Twarrt
    .Enum var moderationStatus: ContentModerationStatus { get set }
  • Timestamp of the model’s creation, set automatically.

    Declaration

    Swift

    @Twarrt
    .Timestamp var createdAt: Date? { get set }
  • Timestamp of the model’s last update, set automatically.

    Declaration

    Swift

    @Twarrt
    .Timestamp var updatedAt: Date? { get set }
  • Timestamp of the model’s soft-deletion, set automatically.

    Declaration

    Swift

    @Twarrt
    .Timestamp var deletedAt: Date? { get set }

Relations

  • The twarrt’s author.

    Declaration

    Swift

    @Twarrt
    .Parent var author: User { get set }
  • When a twarrt is created as a reply to another twarrt, both twarrts get their replyGroup set to the ID of the replied-to twarrt. When a reply is created and the replied-to twarrt is already in a reply group, the new reply joins the existing reply group.

    Declaration

    Swift

    @Twarrt
    .OptionalParent var replyGroup: Twarrt? { get set }
  • The child TwarrtEdit accountability records of the twarrt.

    Declaration

    Swift

    @Twarrt
    .Children var edits: [TwarrtEdit] { get set }
  • The sibling Users who have “liked” the twarrt.

    Declaration

    Swift

    @Twarrt
    .Siblings var likes: [User] { get set }

Initialization