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 :create_dbi_server, action: :create
|
||||||
define :list_dbi_server, action: :read
|
define :list_dbi_server, action: :read
|
||||||
define :get_dbi_server_by_id, args: [:id], action: :by_id
|
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 :update_dbi_server, action: :update
|
||||||
define :destroy_dbi_server, action: :destroy
|
define :destroy_dbi_server, action: :destroy
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -30,6 +30,17 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
|
|||||||
get? true
|
get? true
|
||||||
filter expr(id == ^arg(:id))
|
filter expr(id == ^arg(:id))
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
policies do
|
policies do
|
||||||
@@ -51,7 +62,10 @@ defmodule DecentralisedBookIndex.Metadata.DBIServer do
|
|||||||
public? true
|
public? true
|
||||||
end
|
end
|
||||||
|
|
||||||
timestamps()
|
timestamps do
|
||||||
|
writable? true
|
||||||
|
public? true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
relationships do
|
relationships do
|
||||||
|
|||||||
Reference in New Issue
Block a user