ExTeal.Resource.Model behaviour (ExTeal v0.21.0) View Source
Provides the model/0
callback used to customize the resource served.
This behaviour is used by all ExTeal actions.
Link to this section Summary
Callbacks
Array of default field filters to be used when there are no filters present
Must return the module implementing Ecto.Schema
to be represented.
The fields that should be searched
Returns the singularized version of the title to display on forms.
Returns the subtitle to display in relationships.
Returns the thumbnail to display in search.
Returns the title to display in the side bar.
Returns the title to display in relationships.
Returns the uri to display in the side bar.
Link to this section Callbacks
Specs
default_filters() :: [map()] | nil
Array of default field filters to be used when there are no filters present
Specs
model() :: module()
Must return the module implementing Ecto.Schema
to be represented.
Example:
def model, do: MyApp.Models.Post
Defaults to the name of the resource, for example the resource
MyApp.V1.PostResource
would serve the MyApp.Post
model.
Used by the default implementations for handle_create/2
, handle_update/3
,
and records/1
.
Specs
search() :: [atom()]
The fields that should be searched
Specs
singular_title() :: String.t()
Returns the singularized version of the title to display on forms.
Specs
Returns the subtitle to display in relationships.
Defaults to looking for name or title fields, falls back to the schemas name appended by it's id
Specs
Returns the thumbnail to display in search.
Defaults to looking for name or title fields, falls back to the schemas name appended by it's id
Specs
title() :: String.t()
Returns the title to display in the side bar.
Defaults to finding the title from the resource modules name
Specs
Returns the title to display in relationships.
Defaults to looking for name or title fields, falls back to the schemas name appended by it's id
Specs
uri() :: String.t()
Returns the uri to display in the side bar.
Defaults to finding the uri from the resource modules name