Last active
September 20, 2018 21:23
-
-
Save rafaels88/9a4d59594be096391b303a8d3383ff62 to your computer and use it in GitHub Desktop.
Quiqup - Opus assign convention
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
should contain a send_alert/1, I guess