PhoenixKitManufacturing.Schemas.Machine (PhoenixKitManufacturing v0.2.0)

Copy Markdown View Source

Schema for manufacturing machines (the machines reference book).

A machine is a piece of production equipment: a CNC mill, a press, a laser cutter, etc. Machines are categorized by many-to-many MachineType links, so a single machine can carry several type tags.

The freeform metadata JSONB column holds passport/spec fields that are not yet modeled as columns (power rating, working area, commissioning date, maintenance schedule…), so early iterations don't need a migration for every new attribute. data holds multilang translations.

Summary

Functions

Builds a changeset for a machine.

The list of valid status values.

Types

t()

@type t() :: %PhoenixKitManufacturing.Schemas.Machine{
  __meta__: term(),
  code: term(),
  data: term(),
  description: term(),
  inserted_at: term(),
  location_note: term(),
  machine_type_assignments: term(),
  machine_types: term(),
  manufacturer: term(),
  metadata: term(),
  name: term(),
  serial_number: term(),
  status: term(),
  updated_at: term(),
  uuid: term()
}

Functions

changeset(machine, attrs)

@spec changeset(t(), map()) :: Ecto.Changeset.t()

Builds a changeset for a machine.

statuses()

@spec statuses() :: [String.t()]

The list of valid status values.