Update DBIServer to add a relationship to itself and the sync on attribute.

This commit is contained in:
2025-05-04 21:49:13 +03:00
parent 0415938248
commit 2d78c2bd1b
3 changed files with 174 additions and 2 deletions
@@ -21,12 +21,12 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
create :create do
primary? true
accept [:name, :url]
accept [:name, :url, :sync_on?]
end
update :update do
primary? true
accept [:name, :url]
accept [:name, :url, :sync_on?]
end
read :by_id do
@@ -51,6 +51,10 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
bypass actor_attribute_equals(:role, :admin) do
authorize_if always()
end
policy action_type(:read) do
authorize_if always()
end
end
attributes do
@@ -66,6 +70,11 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
public? true
end
attribute :sync_on?, :boolean do
allow_nil? true
default false
end
timestamps do
writable? true
public? true
@@ -73,6 +82,8 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
end
relationships do
belongs_to :dbi_server, Metadata.DBIServer
has_many :author, Metadata.Author
has_many :author_alias_registries, Metadata.AuthorAliasRegistry
has_many :author_roles, Metadata.AuthorRole