Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding property example in stack blitz #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ A simple string.
- firstName
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-r3tmlw?file=manifest%2Fbackend.yml)

### Textarea

Textarea field for medium-size texts.
Expand All @@ -60,6 +62,8 @@ Textarea field for medium-size texts.
- { name: description, type: text }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-ih3ish?file=manifest%2Fbackend.yml)

### Number

A numerical value.
Expand All @@ -68,6 +72,8 @@ A numerical value.
- { name: age, type: number }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-i339nv?file=manifest%2Fbackend.yml)

### Link

An URL that links to an external page.
Expand All @@ -76,6 +82,8 @@ An URL that links to an external page.
- { name: website, type: link }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-6s8jxx?file=manifest%2Fbackend.yml)

### Money

A money field with a currency. Money properties can have up to 2 digits after coma.
Expand All @@ -90,6 +98,8 @@ A money field with a currency. Money properties can have up to 2 digits after co
| ------------ | ------- | ------ | ------------------------------------------------------------------------------------------------ |
| **currency** | _USD_ | string | [ISO 4217 currency code](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes) |

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-jjlyxu?file=manifest%2Fbackend.yml)

### Date

Basic date field.
Expand All @@ -98,6 +108,8 @@ Basic date field.
- { name: startDate, type: date }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-bmxncv?file=manifest%2Fbackend.yml)

### Timestamp

Timestamp field.
Expand All @@ -106,12 +118,16 @@ Timestamp field.
- { name: acquiredAt, type: timestamp }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-mrz18z?file=manifest%2Fbackend.yml)

### Email

```yaml
- { name: email, type: email }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-5pokfh?file=manifest%2Fbackend.yml)

### Boolean

For any field with a "true or false" value.
Expand All @@ -120,6 +136,8 @@ For any field with a "true or false" value.
- { name: isActive, type: boolean }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-u5iyur?file=manifest%2Fbackend.yml)

### File

A file upload. Read more in the [file upload doc](./upload.md#upload-a-file).
Expand All @@ -128,6 +146,8 @@ A file upload. Read more in the [file upload doc](./upload.md#upload-a-file).
- { name: document, type: file }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-dylmky?file=manifest%2Fbackend.yml)

### Image

An image upload. The different sizes should be provided to generate several sizes of it. Read more in the [image upload doc](./upload.md#upload-an-image).
Expand All @@ -137,7 +157,7 @@ An image upload. The different sizes should be provided to generate several size
name: photo,
type: image,
options:
{ sizes: { small: { height: 90, width: 90 }, large: { width: 200 } } }
{ sizes: { small: { height: 90, width: 90 }, large: { width: 200 } } },
}
```

Expand All @@ -147,6 +167,8 @@ An image upload. The different sizes should be provided to generate several size
| --------- | -------------------------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **sizes** | _thumbnail (80x80)_ _medium (160x160)_ | ImageSizesObject | An object with each key being the name of each size and with `width`, `height` and `fit` optional props. The _fit_ options works as in [Sharp](https://sharp.pixelplumbing.com/api-resize) |

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-rytpmz?file=manifest%2Fbackend.yml)

### Password

Password field. Most of the time you do not need to implement passwords manually as [authenticable entities](./auth.md#authenticable-entities) have built-in `email` and `password` fields to log in.
Expand All @@ -155,6 +177,8 @@ Password field. Most of the time you do not need to implement passwords manually
- { name: password, type: password }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-n15k9a?file=manifest%2Fbackend.yml)

:::warning
When setting the type as `password`, Manifest hashes automatically the value before storing it. Passwords should never be stored as clear text.
:::
Expand All @@ -181,10 +205,14 @@ A given choice of options.
| **values** | _(empty)_ | String[] | An array of strings representing the available choices |
| **sequential** | `false` | boolean | Specifies if the values are ordered in a logical sense |

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-ashxqx?file=manifest%2Fbackend.yml)

### Location

The location type consists in a object with `lat` and `lng` coordinates.

```yaml
- { name: location, type: location }
```

[![Open in Stackblitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/mnfst-manifest-nqb5ix?file=manifest%2Fbackend.yml)