Skip to content

Releases: nicgirault/express-crud-router

v8.1.0

19 Jun 19:46
Compare
Choose a tag to compare

8.1.0 (2024-06-19)

Bug Fixes

Features

  • pass request to fetchAll helpers (330dafe)

v8.0.2

21 Sep 13:59
b2fc8c1
Compare
Choose a tag to compare

8.0.2 (2023-09-21)

Bug Fixes

  • compute additionalAttributes in getOne (a6ba6de)

v8.0.1

18 Sep 14:48
de62308
Compare
Choose a tag to compare

8.0.1 (2023-09-18)

Bug Fixes

v8.0.0

17 Sep 15:29
0e50a3b
Compare
Choose a tag to compare

8.0.0 (2023-09-17)

Features

  • add additional attributes helpers (f7b6fd3)

BREAKING CHANGES

  • additionalAttributes option format changed

v7.0.1

19 Aug 14:08
0276cde
Compare
Choose a tag to compare

7.0.1 (2023-08-19)

Bug Fixes

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

v7.0.0

19 Aug 13:38
14afa9a
Compare
Choose a tag to compare

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

24 May 12:14
b64c1ab
Compare
Choose a tag to compare

6.3.2 (2023-05-24)

Bug Fixes

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

v6.3.1

12 Jan 15:30
Compare
Choose a tag to compare

6.3.1 (2022-01-12)

Bug Fixes

v6.3.0

12 Jan 11:32
Compare
Choose a tag to compare

6.3.0 (2022-01-12)

Features

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

v6.2.0

07 Jan 13:01
4d80bee
Compare
Choose a tag to compare

6.2.0 (2022-01-07)

Features

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