ProfileEdit

final class ProfileEdit : Model, @unchecked Sendable

When a UserProfile is edited, a ProfileEdit is created and associated with the profile. The ProfileEdit records the state of the profile just before the edit occurred.

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: CreateProfileEditSchema the Migration for creating the ProfileEdit table in the database.

Properties

  • id

    The edit’s ID.

    Declaration

    Swift

    @ProfileEdit
    .ID var id: UUID? { get set }
  • The UserProfileData contents of the user’s profile, just before the edit.

    Declaration

    Swift

    @ProfileEdit
    .OptionalField var profileData: UserProfileUploadData? { get set }
  • The user’s userImage filename, just before the edit.

    Declaration

    Swift

    @ProfileEdit
    .OptionalField var profileImage: String? { get set }
  • Timestamp of the model’s creation, set automatically.

    Declaration

    Swift

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

Relations

  • The User whose profile got edited.

    Declaration

    Swift

    @ProfileEdit
    .Parent var user: User { get set }
  • The User that performed the edit. Equal to user if someone’s editing their own profile.

    Declaration

    Swift

    @ProfileEdit
    .Parent var editor: User { get set }

Initialization