- {:ok, scheduled_activity} =
- Cachex.fetch!(:idempotency_cache, idempotency_key, fn _ ->
- ScheduledActivity.create(user, %{"params" => params, "scheduled_at" => scheduled_at})
- end)
-
- conn
- |> put_view(ScheduledActivityView)
- |> render("show.json", %{scheduled_activity: scheduled_activity})
+ with {:ok, scheduled_activity} <-
+ ScheduledActivity.create(user, %{"params" => params, "scheduled_at" => scheduled_at}) do
+ conn
+ |> put_view(ScheduledActivityView)
+ |> render("show.json", %{scheduled_activity: scheduled_activity})
+ end