Event

final class Event : Model, Searchable
extension Event: ContentFilterable

An Event on the official schedule, imported from sched.com’s .ics format.

See

See Also: EventData the DTO for returning info on Events.

See

See Also: CreateEventSchema the Migration for creating the Event table in the database.

See

See Also: EventType

Properties

  • id

    The event’s ID.

    Declaration

    Swift

    @ID
    var id: UUID?
  • uid

    The event’s official identifier. (sched.com “UID”)

    Declaration

    Swift

    @Field
    var uid: String
  • The start time of the event. (sched.com “DTSTART”)

    Declaration

    Swift

    @Field
    var startTime: Date
  • The end time of the event. (sched.com “DTEND”)

    Declaration

    Swift

    @Field
    var endTime: Date
  • The title of the event. (sched.com “SUMMARY”)

    Declaration

    Swift

    @Field
    var title: String
  • A description of the event. (sched.com “DESCRIPTION”)

    Declaration

    Swift

    @Field
    var info: String
  • The location of the event. (sched.com “LOCATION”)

    Declaration

    Swift

    @Field
    var location: String
  • The type of event. (sched.com “CATEGORIES”)

    Declaration

    Swift

    @Field
    var eventType: EventType
  • 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

  • The ID of a forum associated with the event. I believe we want the forum to be the parent of the event so the forum can keep existing even if the event is deleted.

    Declaration

    Swift

    @OptionalParent
    var forum: Forum?
  • The users that have favorited this event.

    Declaration

    Swift

    @Siblings
    var favorites: [User]

Initialization

  • Declaration

    Swift

    init()
  • Initializes a new Event.

    Declaration

    Swift

    init(
    	startTime: Date,
    	endTime: Date,
    	title: String,
    	description: String,
    	location: String,
    	eventType: EventType,
    	uid: String
    )

    Parameters

    startTime

    The start time of the event.

    endTime

    The end time of the event.

    title

    The title of the event.

    description

    A description of the event.

    location

    The location of the event.

    eventType

    The designated type of event.

    uid

    The event’s sched.com identifier.

Functions