podbox_ash/lib/podbox/podcast/resources/asset_feed.ex

39 lines
797 B
Elixir
Raw Normal View History

2024-05-22 13:17:21 +12:00
defmodule Podbox.Podcast.AssetFeed do
@moduledoc """
Join table between podcast feeds and downloaded assets.
"""
use Ash.Resource,
data_layer: AshSqlite.DataLayer,
domain: Podbox.Podcast,
notifiers: [Ash.Notifier.PubSub]
alias Podbox.{Download.Asset, Podcast.Feed, Repo}
2024-05-22 13:17:21 +12:00
@type t :: Ash.Resource.record()
attributes do
uuid_primary_key :id
end
relationships do
belongs_to :asset, Asset, attribute_writable?: true, public?: true
belongs_to :feed, Feed, attribute_writable?: true, public?: true
2024-05-22 13:17:21 +12:00
end
sqlite do
table "podcast_asset_feeds"
repo Repo
end
pub_sub do
module Podbox.PubSub
prefix "podcast:asset_feed"
publish :create, "created"
end
actions do
defaults [:read, :destroy, create: :*, update: :*]
2024-05-22 13:17:21 +12:00
end
end