AshDispatch.Setup (AshDispatch v0.8.5)

View Source

Defines a DeliveryReceipt resource inside your Deliveries domain.

A shortcut for AshDispatch.Resources.DeliveryReceipt.Base: instead of writing a resource file, use this in the domain module and it creates <Domain>.DeliveryReceipt there — built on the same Base, with the domain set to the module you are in.

Usage

defmodule MyApp.Deliveries do
  use AshDispatch.Setup,
    repo: MyApp.Repo,
    notification_resource: MyApp.Notifications.Notification,
    user_resource: MyApp.Accounts.User

  use Ash.Domain

  resources do
    resource MyApp.Deliveries.DeliveryReceipt
  end
end

Then point AshDispatch at it:

config :ash_dispatch,
  delivery_receipt_resource: MyApp.Deliveries.DeliveryReceipt

Options

  • :repo - (required) Ecto repo module
  • :notification_resource - (required) your Notification resource
  • :user_resource - adds a belongs_to :user relationship
  • :table, :notifiers - as for AshDispatch.Resources.DeliveryReceipt.Base
  • :extensions - Ash extensions to add. Defaults to [AshTypescript.Resource] when ash_typescript is installed and [] otherwise. With AshTypescript.Resource the receipt's TypeScript type is "DeliveryReceipt".

For anything the options don't cover — your own policies, actions or relationships — write the resource yourself on AshDispatch.Resources.DeliveryReceipt.Base.