QuartermasterItemEdit

final class QuartermasterItemEdit : Model, @unchecked Sendable

When the TEXT FIELDS of a QuartermasterItem are edited, a QuartermasterItemEdit is created to save the previous values of those text fields, plus the hideOwnerName setting.

Edits that only change the category — without touching item_name, item_description, location, or hideOwnerName — do not create a QuartermasterItemEdit. This is done for accountability purposes; the data collected is intended to be viewable only by moderators.

See

See Also: QuartermasterModerationData the DTO returning data moderators need to review items. Specifically, QuartermasterEditLogData delivers values from the QuartermasterItemEdit.

See

See Also: CreateQuartermasterItemEditSchema the Migration for creating the QuartermasterItemEdit table.
  • Declaration

    Swift

    static let schema: String
  • id

    The edit’s ID.

    Declaration

    Swift

    @QuartermasterItemEdit
    .ID var id: UUID? { get set }
  • The previous item name.

    Declaration

    Swift

    @QuartermasterItemEdit
    .Field var itemName: String { get set }
  • The previous item description (empty string when nil at edit time).

    Declaration

    Swift

    @QuartermasterItemEdit
    .Field var itemDescription: String { get set }
  • The previous location string (empty string when nil at edit time).

    Declaration

    Swift

    @QuartermasterItemEdit
    .Field var location: String { get set }
  • The previous image filename (empty string when there was no image at edit time).

    Declaration

    Swift

    @QuartermasterItemEdit
    .Field var image: String { get set }
  • Whether the owner’s name was hidden at edit time.

    Declaration

    Swift

    @QuartermasterItemEdit
    .Field var hideOwnerName: Bool { get set }
  • Timestamp of the model’s creation, set automatically.

    Declaration

    Swift

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

Relations

Initialization

  • Declaration

    Swift

    init()
  • Initializes a new QuartermasterItemEdit with the CURRENT text fields of the item. Call this before applying the edit so that the prior state is captured.

    Declaration

    Swift

    init(item: QuartermasterItem, editorID: UUID) throws

    Parameters

    item

    The QuartermasterItem about to be edited.

    editorID

    The UUID of the User making the change.