2024-02-29 15:23:15 +13:00
|
|
|
defmodule AshPostgres.Test.PostFollower do
|
2024-02-29 16:55:53 +13:00
|
|
|
@moduledoc false
|
2024-02-29 15:23:15 +13:00
|
|
|
use Ash.Resource,
|
2024-03-28 09:52:28 +13:00
|
|
|
domain: AshPostgres.Test.Domain,
|
2024-02-29 15:23:15 +13:00
|
|
|
data_layer: AshPostgres.DataLayer
|
|
|
|
|
|
|
|
postgres do
|
|
|
|
table "post_followers"
|
|
|
|
repo AshPostgres.TestRepo
|
|
|
|
end
|
|
|
|
|
|
|
|
actions do
|
2024-03-28 09:52:28 +13:00
|
|
|
default_accept(:*)
|
|
|
|
|
2024-02-29 15:23:15 +13:00
|
|
|
defaults([:create, :read, :update, :destroy])
|
|
|
|
end
|
|
|
|
|
|
|
|
attributes do
|
|
|
|
uuid_primary_key(:id)
|
|
|
|
end
|
|
|
|
|
|
|
|
relationships do
|
|
|
|
belongs_to :post, AshPostgres.Test.Post do
|
2024-03-28 09:52:28 +13:00
|
|
|
public?(true)
|
2024-02-29 15:23:15 +13:00
|
|
|
allow_nil?(false)
|
|
|
|
end
|
|
|
|
|
|
|
|
belongs_to :follower, AshPostgres.Test.User do
|
2024-03-28 09:52:28 +13:00
|
|
|
public?(true)
|
2024-02-29 15:23:15 +13:00
|
|
|
allow_nil?(false)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|