Modifying the Boundary of the Mastery Project
Let’s learn to make changes to our API in Mastery to enable notifications for starting and stopping our quizzes.
We'll cover the following...
We’ll start with /lib/mastery.ex
to make the API changes, enabling that new API in the boundary.
Modifying the API
In Mastery, we need to change the API to accept our new notify_pid
, like this:
Press + to interact
def schedule_quiz(quiz, templates, start_at, end_at, notify_pid \\ nil) dowith :ok <- QuizValidator.errors(quiz),true <- Enum.all?(templates, &(:ok == TemplateValidator.errors(&1))),:ok <-Proctor.schedule_quiz(quiz,templates,start_at,end_at,notify_pid),do: :ok, else: (error -> error)end
That’s simple enough:
-
We add a new optional argument to ...