Skip to main content
Version: v1.0.0(int)

Locations

Fulfillment locations — warehouses, fulfillment centers, work sites. Same entity reused as PO ship-to, WO work site, SO fulfillment location, and inventory bin.

Tables owned​

TablePurpose
org.locationsLocation records (name, address, city, state, country, zip_code, notes, sort_order). Emails / phones live in the contacts domain via entity_contacts, not on this table.

Operations​

Writes​

  • create(conn, input) → Location. input: { name, country?, address?, city?, state?, zipCode?, notes?, sortOrder? }.
  • update(conn, locationId, patch) → Location. Partial update including sortOrder.
  • delete(conn, locationId) → void. Hard-delete. L3 enforces "not referenced by any PO/WO/SO/ledger" before calling.

Reads​

  • list(conn) → Location[]. Ordered by sort_order.
  • getById(conn, locationId) → Location | null.
  • getByIds(conn, locationIds) → Location[]. Batch hydration.
  • isInUse(conn, locationId) → { inUse: boolean, references: { poCount, woCount, soCount, ledgerCount } }. Gates deletion in L3.