-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SoftDelete2 use null or -1 #508
Comments
Yes I agree, the In a SQL database for example you can't have a It checks if the value > -1 or >= 0 const result = context.result ? context.result.data || context.result : null;
if (skipProbeOnGet && result && result[deletedAt] >= 0) {
throw new errors.NotFound(deletedMessage, { id: context.id });
} if (record[options.deletedAt || defaultDeletedAt] > -1) {
throw new errors.NotFound(deletedMessage, { id: context.id });
} I copied the hook and changed that line to: const result = context.result ? context.result.data || context.result : null;
const resultDeletedAt = result[options.deletedAt || defaultDeletedAt];
if (skipProbeOnGet && result && resultDeletedAt && resultDeletedAt !== -1) {
throw new errors.NotFound(deletedMessage, { id: context.id });
} const recordDeletedAt = record[options.deletedAt || defaultDeletedAt];
if (recordDeletedAt && recordDeletedAt !== -1) {
throw new errors.NotFound(deletedMessage, { id: context.id });
} Everywhere else where the deletedAt is set to |
I ended up creating a hook which does this for me.
|
That would be a breaking change.
Docs say it's using |
It is possible to specify the value which is used, as currently
null
does not work as it's expecting-1
.I think the use of
null
is fair for rows which have not been deleted, whereas-1
works for rows which have been deleted but have been restored.The text was updated successfully, but these errors were encountered: