Skip to content

Instantly share code, notes, and snippets.

@rafaels88
Last active September 20, 2018 21:23
Show Gist options
  • Save rafaels88/9a4d59594be096391b303a8d3383ff62 to your computer and use it in GitHub Desktop.
Save rafaels88/9a4d59594be096391b303a8d3383ff62 to your computer and use it in GitHub Desktop.
Quiqup - Opus assign convention
defmodule Quiqup.DispatchOrderStagePipeline do
use Opus.Pipeline
step :assign_availability
step :persist, if: :available?
step :send_alert, if: :persisted?
def assign_availability(pipeline) do
put_in(pipeline, [:availability], :unavailable)
end
def persist(%{order: order} = pipeline) do
stage = persist_stage(order)
put_in(pipeline, [:stage], stage)
end
def send_alert(), do: #something
def available?(%{availability: :available}), do: true
def available?(_), do: false
def persisted?(%{stage: _}), do: true
def persisted?(_), do: false
end
Quiqup.DispatchOrderStagePipeline.call(%{order: order})
@chgeuer
Copy link

chgeuer commented Sep 20, 2018

should contain a send_alert/1, I guess

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment