defmodule NotificationDispatcher.Controller.NotificationMessageController do alias NotificationDispatcher.Context.NotificationsContext @doc """ Create can return {:ok, notification_message, json} or {:error, changeset} """ def create(params) do case NotificationsContext.create_notification_message(params) do {:ok, notification_message} -> {:ok, notification_message, %{data: %{id: notification_message.id}}} {:error, changeset} -> {:error, changeset} end end end