Update DBIServer to add a relationship to itself and the sync on attribute.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user