Releases: nicgirault/express-crud-router
Releases · nicgirault/express-crud-router
v6.1.5
v6.1.4
v6.1.3
v6.1.2
v6.1.1
v6.1.0
v6.0.2
v6.0.1
v6.0.0
6.0.0 (2020-09-06)
Bug Fixes
- trigger breaking change (ecd89c6)
BREAKING CHANGES
- this release is almost a total rewrite of the lib.
Simple use case:
- crud('/admin/user', User)
+ crud('/admin/user', sequelizeCrud(User))
Limit actions:
- 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:
- 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 } }),
+ })
+ )