Announcement

final class Announcement : Model

Admins can create Announcements, which are text strings intended to be shown to all users. All announcements have a ‘display until’ time, and are considered ‘active’ until their display until time expires.

Announcement IDs are ints, and increase with each announcement created. The User model stores the highest Announcement ID the user has seen.

Announcements are global, and are retrieveable while logged out. However, endpoints returning announcement data will only return all active announcements for logged-out users. Logged-in users will additionally get data indicating which announcements are unread. Clients may implement local solutions for determining which announcements are unread for logged-out users.

See

See Also: AnnouncementData the DTO for returning info on Announcements.

See

See Also: AnnouncementCreateData the DTO for creating and editing Announcements.

See

See Also: CreateAnnouncementSchema the Migration that creates the Announcement table in the database.

Properties

  • id

    The announcement’s ID.

    Declaration

    Swift

    @ID
    var id: Int?
  • The text content of the announcement.

    Declaration

    Swift

    @Field
    var text: String
  • The announcement is considered ‘active’ until this time. Most API endpoints only return info on active announcements.

    Declaration

    Swift

    @Field
    var displayUntil: Date
  • Timestamp of the model’s creation, set automatically.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    @Timestamp
    var deletedAt: Date?

Relations

Initialization