Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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