QuartermasterItem

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

A QuartermasterItem is a single entry on the Quartermaster “have / need” board.

Any logged-in user can post an item they have to offer or an item they are looking for. Each entry may optionally specify a free-text location, and may hide the owner’s name from other users. When the owner’s name is hidden, a location is required, since it becomes the only way for other users to identify how to find the item (validated in the controller).

Items are searchable, filterable by category (have/need) and by owner, and are individually reportable to the mod queue. Moderators may quarantine or delete entries exactly as they do for forum posts. Edits to text fields are snapshotted in QuartermasterItemEdit for accountability.

See

See Also: QuartermasterData the DTO for returning item data.

See

See Also: QuartermasterContentData the DTO for creating or editing items.

See

See Also: CreateQuartermasterItemSchema the Migration creating the table.

Properties

  • id

    Unique ID for this item.

    Declaration

    Swift

    @QuartermasterItem
    .ID var id: UUID? { get set }
  • Whether the owner has this item to offer, or needs it.

    Declaration

    Swift

    @QuartermasterItem
    .Field var category: QuartermasterCategory { get set }
  • A short name or title for the item. Required; 2–100 characters (validated in controller).

    Declaration

    Swift

    @QuartermasterItem
    .Field var itemName: String { get set }
  • An optional longer description of the item. ≤2048 characters when present.

    Declaration

    Swift

    @QuartermasterItem
    .OptionalField var itemDescription: String? { get set }
  • An optional free-text location where the item can be picked up / exchanged. When present: 3–100 characters (validated in the controller DTO).

    Declaration

    Swift

    @QuartermasterItem
    .OptionalField var location: String? { get set }
  • An optional filename referencing an uploaded photo of the item. At most one image per item.

    Declaration

    Swift

    @QuartermasterItem
    .OptionalField var image: String? { get set }
  • Moderators can set several statuses on items that modify editability and visibility.

    Declaration

    Swift

    @QuartermasterItem
    .Enum var moderationStatus: ContentModerationStatus { get set }

Relationships

  • The user who created this item listing.

    Declaration

    Swift

    @QuartermasterItem
    .Parent var owner: User { get set }
  • When true, the owner’s identity is hidden from other users viewing this item (the owner and moderators can still see it). A location is required when this is set.

    Declaration

    Swift

    @QuartermasterItem
    .Field var hideOwnerName: Bool { get set }
  • The child QuartermasterItemEdit accountability records for this item.

    Declaration

    Swift

    @QuartermasterItem
    .Children var edits: [QuartermasterItemEdit] { get set }

Record-keeping

  • Timestamp of the model’s creation, set automatically.

    Declaration

    Swift

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

    Declaration

    Swift

    @QuartermasterItem
    .Timestamp var updatedAt: Date? { get set }
  • Timestamp of the model’s soft-deletion, set automatically. Soft-delete allows moderators to view deleted entries.

    Declaration

    Swift

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

Initialization

  • Declaration

    Swift

    init()
  • Initializes a new QuartermasterItem.

    Declaration

    Swift

    init(
    	ownerID: UUID,
    	category: QuartermasterCategory,
    	itemName: String,
    	itemDescription: String? = nil,
    	location: String? = nil,
    	hideOwnerName: Bool = false,
    	image: String? = nil
    )

    Parameters

    ownerID

    The UUID of the user creating the listing.

    category

    Whether the owner has or needs the item.

    itemName

    A short name for the item (2–100 chars).

    itemDescription

    An optional longer description (≤2048 chars).

    location

    An optional free-text pickup/exchange location.

    hideOwnerName

    Whether to hide the owner’s identity from other users. Defaults to false.

    image

    An optional filename referencing an already-processed uploaded photo.

Reportable

ContentFilterable