Add the search action for DBIServer.
This commit is contained in:
@@ -100,6 +100,7 @@ defmodule DecentralisedBookIndex.Metadata do
|
||||
define :create_dbi_server, action: :create
|
||||
define :list_dbi_server, action: :read
|
||||
define :get_dbi_server_by_id, args: [:id], action: :by_id
|
||||
define :search_dbi_server, action: :search, args: [:name]
|
||||
define :update_dbi_server, action: :update
|
||||
define :destroy_dbi_server, action: :destroy
|
||||
end
|
||||
|
||||
@@ -30,6 +30,17 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
|
||||
get? true
|
||||
filter expr(id == ^arg(:id))
|
||||
end
|
||||
|
||||
read :search do
|
||||
argument :name, :ci_string do
|
||||
constraints allow_empty?: true
|
||||
default ""
|
||||
end
|
||||
|
||||
filter expr(contains(name, ^arg(:name)))
|
||||
|
||||
pagination offset?: true, default_limit: 10
|
||||
end
|
||||
end
|
||||
|
||||
policies do
|
||||
@@ -51,7 +62,10 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
|
||||
public? true
|
||||
end
|
||||
|
||||
timestamps()
|
||||
timestamps do
|
||||
writable? true
|
||||
public? true
|
||||
end
|
||||
end
|
||||
|
||||
relationships do
|
||||
|
||||
Reference in New Issue
Block a user