Schemas - StudioDeTelevision/admiraljs GitHub Wiki

admiral.setSchema([...]) An array of schema for each collection you want to edit see example file in config/sample Attributes are:

schemaName

a unique configuration name

model

your model name

label

the label displayed in left menu bar
then define the right url for:

create , update , find, destroy (optionnal)

Those optionnal parameters are useful if you need to use a particular API than the basic one and/or if you need to specify some parameters (ex: "create":"event/create?type=concert" )

TIP:

For the find action, you may specify a find filter by using:

"findFilter":{"where":{"space_id":"Pm4jPHmoakKcRAEo4"}},

Or use a function: "findFilter":function() { return { "sort":{ createdAt: 'asc'},"where":{"space_id":"athome","date_end":{'>=': moment().format('YYYY-MM-DD HH:mm')}}} },

you may use many schemas based on the same model
you'll have to give them different schemaName
and you may also provide different findFilter
(this can be useful on nosql database, if you want to use a single collection for documents with differents schemas)

listFields

the fields displayed in a list view

searchFields

the fields you want the search to occur on

fields define your fields

(see config/example/schemas.json for more explanations)