id |
---|
properties |
Properties are the characteristics of your entities. For example, a Product can have properties like name
, description
, price
...
You can add the properties to your entities in the backend.yml file
name: Blog about cats
entities:
📝 Post:
properties:
- name # Short syntax for string type.
- { name: content, type: text } # Property type specified.
- { name: publishedAt, type: date }
- { name: authorEmail, type: email, hidden: true } # Extra options.
You can pass arguments using the long syntax:
Option | Default | Type | Description |
---|---|---|---|
type | "string" | PropType | The Property type (text, number, email, location...) |
hidden | false |
boolean | If the property should be hidden in the API response |
options | - | Object | Specific options depending on type |
Each property has a type that represents real-world usages. Some of them have specific options.
A simple string.
- { name: firstName, type: string }
# Short syntax, same as above.
- firstName
Textarea field for medium-size texts.
- { name: description, type: text }
A numerical value.
- { name: age, type: number }
An URL that links to an external page.
- { name: website, type: link }
A money field with a currency. Money properties can have up to 2 digits after coma.
- { name: price, type: money, options: { currency: "EUR" } }
Option | Default | Type | Description |
---|---|---|---|
currency | USD | string | ISO 4217 currency code |
Basic date field.
- { name: startDate, type: date }
Timestamp field.
- { name: acquiredAt, type: timestamp }
- { name: email, type: email }
For any field with a "true or false" value.
- { name: isActive, type: boolean }
Password field. Most of the time you do not need to implement passwords manually as authenticable entities have built-in email
and password
fields to log in.
- { name: password, type: password }
:::warning
When setting the type as password
, Manifest hashes automatically the value before storing it. Passwords should never be stored as clear text.
:::
A given choice of options.
- { name: sex, type: choice, options: { values: [male, female] } }
# Sequential if the values are ordered in a logical sense..
- {
name: status,
type: choice,
options: { values: [draft, submitted, published], sequential: true },
}
Option | Default | Type | Description |
---|---|---|---|
values | (empty) | String[] | An array of strings representing the available choices |
sequential | false |
boolean | Specifies if the values are ordered in a logical sense |
The location type consists in a object with lat
and lng
coordinates.
- { name: location, type: location }