Skip to content

Commit

Permalink
fix: trigger breaking change
Browse files Browse the repository at this point in the history
BREAKING CHANGE: this release is almost a total rewrite of the lib.

Simple use case:

```diff
- crud('/admin/user', User)
+ crud('/admin/user', sequelizeCrud(User))
```

Limit actions:

```diff
- app.use(
-   crud("/admin/users", User, {
-     destroy: () => throw new Error('delete is not allowed')
-   })
- );
+ app.use(
+   crud('/admin/users', {
+     ...sequelizeCrud(User),
+     destroy: null,
+   })
+ )
```

Custom behaviors:

```diff
- app.use(
-   crud('/admin/users', User, {
-     getList: (filter, limit, offset, order) =>
-       User.findAndCountAll({ limit, offset, order, where: filter }),
-     getOne: id => User.findByPk(id),
-     create: body => User.create(body),
-     update: (body, options) => User.update(body, options),
-     destroy: body => User.destroy(body),
-   })
- )
+ app.use(
+   crud('/admin/users', {
+     getList: ({ filter, limit, offset, order }) =>
+       User.findAndCountAll({ limit, offset, order, where: filter }),
+     getOne: id => User.findByPk(id),
+     create: body => User.create(body),
+     update: (id, body) => User.update(body, { where: { id } }),
+     destroy: id => User.destroy({ where: { id } }),
+   })
+ )
```
  • Loading branch information
nicgirault committed Sep 6, 2020
1 parent 3b41446 commit ecd89c6
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,5 @@ To trigger a major version release write in the core of the commit message:
```
feat: my commit
BREAKING CHANGE: detail here
```

0 comments on commit ecd89c6

Please sign in to comment.