Add `isSoftDeleted` helper method to model instances (#7531)
* Add `isSoftDeleted` helper method to model instances Since users can rename the `deletedAt` field when creating a model it is helpful to have a `isSoftDeleted` so other users of the DB don't have to hard code the custom `deletedAt` field name throughout their codebase. Addresses: https://github.com/sequelize/sequelize/issues/7408 * Update `isSoftDeleted` to check for dates in the future If the soft-delete property (default is `deleted_at`) is set, but it's set to a date in the future, then `isSoftDeleted` should return `false`. * Update `isSoftDeleted` to return `true` if `deletedAt` is now * Rename variable `isNotSet` to `isSet` and inverse logic This helps with readability and understanding.
Showing
with
173 additions
and
1 deletions
test/unit/instance/is-soft-deleted.test.js
0 → 100644
-
Please register or sign in to post a comment