Express Sequelize Crud Versions Save

Simply expose resource CRUD (Create Read Update Delete) routes for Express & Sequelize. Compatible with React Admin Simple Rest Data Provider

v8.1.0

2 weeks ago

8.1.0 (2024-06-19)

Bug Fixes

Features

  • pass request to fetchAll helpers (330dafe)

v8.0.2

9 months ago

8.0.2 (2023-09-21)

Bug Fixes

  • compute additionalAttributes in getOne (a6ba6de)

v8.0.1

9 months ago

8.0.1 (2023-09-18)

Bug Fixes

v8.0.0

9 months ago

8.0.0 (2023-09-17)

Features

  • add additional attributes helpers (f7b6fd3)

BREAKING CHANGES

  • additionalAttributes option format changed

v7.0.1

10 months ago

7.0.1 (2023-08-19)

Bug Fixes

  • make sure update always return the id of the record (364785b)

v7.0.0

10 months ago

7.0.0 (2023-08-19)

Code Refactoring

  • force consistency between getList, getOne and search (f4e9b0a)

Features

  • add additionalFields option to populate computed fields (8d759be)
  • support asynchronous custom filters (fa18d2f)

BREAKING CHANGES

  • getOne and search are not anymore necessary as they are deduced from getList handler (renamed get). search definition must be handled thanks to filters option:
crud('/admin/users', {
-  search: async (q, limit) => {
-    const { rows, count } = await User.findAndCountAll({
-      limit,
-      where: {
-        [Op.or]: [
-          { address: { [Op.iLike]: `${q}%` } },
-          { zipCode: { [Op.iLike]: `${q}%` } },
-          { city: { [Op.iLike]: `${q}%` } },
-        ],
-      },
-    })
-
-    return { rows, count }
  },
+ {
+   filters: {
+      q: q => ({
+        [Op.or]: [
+          { address: { [Op.iLike]: `${q}%` } },
+          { zipCode: { [Op.iLike]: `${q}%` } },
+          { city: { [Op.iLike]: `${q}%` } },
+        ],
+      })
+    }
  }
})
  • custom filter handlers do not anymore return the value associated to the key of the given handler. Instead the returned value must be an object that will be merged in the filters passed to the getter handler. In order to keep the same behavior for an existing custom filter, the following modification must be implemented:
crud('/admin/users', sequelizeCrud(User), {
  filters: {
    email: value => ({
-      [Op.iLike]: value,
+      email: {[Op.iLike]: value },
      },
    }),
  },
})

Asynchronous custom filters are now supported:

const filters = {
  categoryName: async value => {
    const category = await Category.findOne({ name: value }).orFail()

    // this object will be merged in filters given to the getter handler
    return {
      categoryId: category.id,
    }
  },
}

v6.3.2

1 year ago

6.3.2 (2023-05-24)

Bug Fixes

  • Fix empty react-admin reference field on big pages (95921a8)

v6.3.1

2 years ago

6.3.1 (2022-01-12)

Bug Fixes

v6.3.0

2 years ago

6.3.0 (2022-01-12)

Features

  • ✨ separate express-sequelize-crud in 2 distinct packages (08f79ae)

v6.2.0

2 years ago

6.2.0 (2022-01-07)

Features

  • expose req/res in crud methods (2bd46ba)
  • search is smarter when searching UUID (2ce61e9)