Skip to main content

Product Unit Properties

This table defines the structure of the product unit entity, including all properties and their descriptions. Product units represent individual instances of products that can be tracked and managed independently.

πŸ”‘ Core Properties​

PropertyTypeRequiredDescription
idstringNo (Auto)Unique identifier for the unit
productIdstringYesID of the parent product
activebooleanNoWhether the unit is active (default: true)
serialNumberstringNoUnique serial number for physical units
assignedTostringNoID of user or group assigned to this unit

πŸ“˜ Interpretation​

  • id is auto-generated if not provided
  • productId must reference an existing product
  • active controls unit availability
  • serialNumber should be unique when provided
  • assignedTo references a user or group ID

🎯 Example Use Cases​

{
"id": "unit_01G5H2V6J7K8L9M0N",
"productId": "prod_01F4G5H6J7K8L9M0",
"active": true,
"serialNumber": "SN2025051234",
"assignedTo": "user_01A2B3C4D5E6F7G8"
}

πŸ“Š Status Properties​

PropertyTypeRequiredDescription
statusstringNoCurrent status of the unit
statusReasonstringNoReason for current status
lastActivedatetimeNoLast time unit was active

πŸ“˜ Interpretation​

  • status can be: "available", "assigned", "inactive"
  • statusReason provides context for status changes
  • lastActive is auto-updated on status changes

🎯 Example Use Cases​

{
"status": "assigned",
"statusReason": "Allocated to development team",
"lastActive": "2025-05-22T15:30:00Z"
}

🏷️ Metadata Properties​

PropertyTypeRequiredDescription
notesstringNoAdditional information about the unit
tagsstring[]NoCustom tags for categorization
extraFieldsobjectNoCustom additional fields

πŸ“˜ Interpretation​

  • notes can contain any relevant information
  • tags help with unit categorization
  • extraFields allows custom properties

🎯 Example Use Cases​

{
"notes": "Development license - Team A",
"tags": ["development", "temporary"],
"extraFields": {
"location": "HQ Office",
"department": "Engineering"
}
}

βŒ› Tracking Properties​

PropertyTypeRequiredDescription
createdAtdatetimeNo (Auto)Unit creation timestamp
updatedAtdatetimeNo (Auto)Last update timestamp
assignedAtdatetimeNoWhen unit was assigned
expiresAtdatetimeNoUnit expiration date

πŸ“˜ Interpretation​

  • createdAt and updatedAt are system-maintained
  • assignedAt tracks assignment timing
  • expiresAt used for time-limited units

🎯 Example Use Cases​

{
"createdAt": "2025-05-22T10:00:00Z",
"updatedAt": "2025-05-22T15:30:00Z",
"assignedAt": "2025-05-22T15:30:00Z",
"expiresAt": "2026-05-22T23:59:59Z"
}

πŸ“ Validation Rules​

  1. Core Properties

    • id must be unique
    • productId must reference valid product
    • serialNumber must be unique if provided
  2. Status Properties

    • status must be valid enum value
    • lastActive must be valid datetime
  3. Metadata Properties

    • tags array items must be strings
    • extraFields must be valid JSON object
  4. Tracking Properties

    • expiresAt must be future date
    • All dates must be valid ISO 8601