PhoenixKitLocations.Schemas.LocationTypeAssignment (PhoenixKitLocations v0.1.3)

Copy Markdown View Source

Join table for many-to-many between locations and location types.

Summary

Functions

Builds an insert changeset for a location ↔ type assignment.

Types

t()

@type t() :: %PhoenixKitLocations.Schemas.LocationTypeAssignment{
  __meta__: term(),
  inserted_at: term(),
  location: term(),
  location_type: term(),
  location_type_uuid: term(),
  location_uuid: term(),
  updated_at: term(),
  uuid: term()
}

Functions

changeset(assignment, attrs)

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

Builds an insert changeset for a location ↔ type assignment.

Casts the two FK columns + timestamps and wires assoc_constraint/2 on both :location and :location_type so an FK violation comes back as a clean {:error, changeset} instead of an Ecto.ConstraintError raise. Without these the Batch 3a :error-branch activity-logging code would never fire.