Commit Graph

10 Commits

Author SHA1 Message Date
Romain Lanz
8e46d02ed1
feat: add NoTimestamp trait + ConvertEmptyStringsToNull middleware (#30)
Hey! 👋 

This PR add some middleware and traits by default.

**Middleware**:

- `AllowGuestOnly` throws an exception if you are authenticated.
- `ConvertEmptyStringsToNull` converts empty strings in the request body to `null`

**Trait**:

- `NoTimestamp` removes the need for `created_at` and `updated_at` fields.
- `FormatDate` formats the date following a convention.

**FormatDate**

The convention is:
- Ends with `_at` => DateTime
- Ends with `_on` => Date

You can change the format you use in your UI with two getters.

```js
class MyModel extends Model {
  static get formatDate () { return 'DD.MM.YYYY' }
  static get formatDateTime () { return 'DD.MM.YYYY HH:mm' }
}
```

You can also directly change default values inside the Trait since it is a user Trait and not defined in the core.

<hr>

If this is merged, I'll provide the same PR to the `API` blueprint.
2019-01-02 10:10:56 +01:00
Romain Lanz
403223214f
fix(route): fix import syntax 2018-10-05 15:14:58 +02:00
Harminder Virk
bbcefa9097 feat(middleware): add named guest middleware 2018-10-01 20:28:31 +02:00
Johnny Wu
1d002c47d3 fix type of Route (#31) 2018-10-01 20:23:03 +02:00
Romain Lanz
b38ea8d773
feat(intellisense): add type comments 2018-09-15 09:37:07 +02:00
Emirhan Engin
702c41a25f Update routes.js (#29)
This will be more accurate.
2018-06-16 08:40:33 +02:00
Jofry
d8d11858ea fix: typo (#21)
`Server levl` into `Server level`
2018-06-05 17:53:20 +05:30
Abijeet
ad27e12100 Changes the invalid routing URL path.
Fixes #10

Signed-off-by: Abijeet <abijeetpatro@gmail.com>
2018-02-09 17:05:39 +05:30
Harminder Virk
22f43b4012 fix(kernel): add cors as server middleware 2017-09-03 22:12:05 +05:30
Harminder Virk
991657c76b feat(*) initial commit 2017-08-20 22:39:25 +05:30