Skip to main content

Equipment

Represents a physical piece of transportation equipment (truck, trailer, chassis, etc.) owned or managed by an organization. Equipment records are organization-scoped and support soft-deletion and extensible custom values.

Fields

FieldTypeRequiredMax LengthDescription
equipmentIdIntPrimary key
organizationIdIntYesOwning organization
unitNumberStringYes50Unique identifier within the organization (e.g., truck number, trailer number). Unique constraint includes soft-deleted records.
equipmentTypeIdIntYesFK to EquipmentType — must belong to the same organization
equipmentStatusIdIntYesFK to EquipmentStatus — must belong to the same organization
notesString?No700Free-text notes
customValuesJSON?NoJSONB dictionary of organization-specific properties
isDeletedBoolSoft-delete flag. Set by Delete() or ChangeIsDeleted(). Filtered from default queries.
createdDateTimeAudit: creation timestamp
createdByStringAudit: creating user ID
lastModifiedDateTimeAudit: last modification timestamp
lastModifiedByStringAudit: last modifying user ID

Relationships

  • Organization — belongs to one Organization
  • EquipmentType — many-to-one; defines the equipment category (truck, trailer, etc.)
  • EquipmentStatus — many-to-one; current status with lifecycle stage and color

Domain Methods

MethodDescription
ChangeUnitNumber(string)Update the unit number
ChangeEquipmentTypeId(int)Reassign equipment type
ChangeEquipmentStatusId(int)Change current status
ChangeNotes(string?)Update or clear notes
ChangeCustomValues(Dictionary<string, object?>?)Full-replace — pass null to clear all custom values, or a new dictionary to replace the entire set
ChangeCustomValue(string fieldName, object? value)Single-key upsert — adds or updates one key without affecting others
ChangeIsDeleted(bool)Toggle soft-delete state
Delete()Convenience method that sets IsDeleted = true

Soft-Delete Behavior

Equipment uses soft-deletion. The IsDeleted flag is applied as a global query filter — deleted equipment does not appear in standard queries unless filters are explicitly ignored.

The UnitNumber uniqueness constraint applies across all records including soft-deleted ones. Restoring a deleted equipment record with a unit number that has been reused will fail validation.

Custom Values

CustomValues is a Dictionary<string, object?> persisted as JSONB. Two update modes are available:

Full-replace (use when updating multiple keys at once):

- task: Equipment/Update@1
inputs:
organizationId: ${organizationId}
equipmentId: ${equipmentId}
equipment:
customValues:
licensePlate: "ABC-1234"
color: "White"
year: 2022

Passing null for customValues preserves the existing dictionary (no-op). To clear all custom values, use the full-replace with an empty object or use the domain method directly.

Single-key update (use to update one key without affecting others):

- task: Equipment/ChangeCustomValue@1
inputs:
organizationId: ${organizationId}
equipmentId: ${equipmentId}
key: "lastInspectionDate"
value: "2026-04-15"

See Custom Values for filtering, sorting, and UI configuration.

Workflow Examples

Create equipment

- task: Equipment/Create@1
name: createEquipment
inputs:
organizationId: ${organizationId}
equipment:
unitNumber: "TRL-0042"
equipmentTypeId: ${trailerTypeId}
equipmentStatusId: ${availableStatusId}
notes: "48ft flatbed"
customValues:
licensePlate: "XYZ-9900"
year: 2021

Change status

- task: Equipment/Update@1
inputs:
organizationId: ${organizationId}
equipmentId: ${equipmentId}
equipment:
equipmentStatusId: ${inUseStatusId}

Soft-delete equipment

- task: Equipment/Delete@1
inputs:
organizationId: ${organizationId}
equipmentId: ${equipmentId}

Validation Rules

  • unitNumber is required and must be unique within the organization (including deleted records).
  • equipmentTypeId must reference an EquipmentType that exists in the same organization.
  • equipmentStatusId must reference an EquipmentStatus that exists in the same organization.

See Also