AshDispatch.Resources.DeliveryReceipt.Base (AshDispatch v0.5.0)
View SourceProvides the base DSL for DeliveryReceipt resources.
This module exports a __using__ macro that consuming apps can use to create
their own DeliveryReceipt resource with a user relationship, similar to how
ash_paper_trail creates version resources.
Usage
defmodule MyApp.Deliveries.DeliveryReceipt do
use AshDispatch.Resources.DeliveryReceipt.Base,
repo: MyApp.Repo,
domain: MyApp.Deliveries,
notification_resource: MyApp.Notifications.Notification,
extensions: [AshTypescript.Resource]
# Optional: TypeScript type configuration
typescript do
type_name("DeliveryReceipt")
end
# Add your User relationship
relationships do
belongs_to :user, MyApp.Accounts.User do
source_attribute :user_id
destination_attribute :id
allow_nil? true
public? true
end
end
endOptions
:repo- (required) Ecto repo module:domain- (required) Ash domain for the resource:notification_resource- (required) Your Notification resource module:user_resource- User resource module for auto-created relationship (optional):extensions- Additional Ash extensions (e.g.,[AshTypescript.Resource]):table- Postgres table name. Defaults to"delivery_receipts". Override when the consumer app needs ash_dispatch resources under a separate namespace (e.g.,table: "dispatch_delivery_receipts").