DripDrop.Enrollment (DripDrop v0.1.0)

Copy Markdown View Source

A subscriber's lifecycle through a sequence.

Summary

Functions

Returns true when an enrollment can move from state to next_state.

Builds a changeset for an enrollment lifecycle row.

Builds a state-transition changeset when the transition is allowed.

Functions

allowed_transition?(state, next_state)

@spec allowed_transition?(binary(), binary()) :: boolean()

Returns true when an enrollment can move from state to next_state.

changeset(enrollment, attrs)

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

Builds a changeset for an enrollment lifecycle row.

transition_changeset(enrollment, next_state)

@spec transition_changeset(Ecto.Schema.t(), binary()) :: Ecto.Changeset.t()

Builds a state-transition changeset when the transition is allowed.