-
Notifications
You must be signed in to change notification settings - Fork 75
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
Better handle paranoid models #405
Comments
There are situations when the master data is maintained in a third-party system and transferred automatically to the Featners App. The same record from the master system can come in the beginning with the status If the Executing the
|
@Servaker This only happens when "setting" |
We should be cautious of any methods that do get/find AFTER modification. This can cause issues when using
paranoid
models. Sequelize'sparanoid
option automatically addsWHERE deleatedAt IS NULL
to queries. This means if the user patch/updatesdeletedAt: new Date()
, the the adapter's uses of_getOrFind
after theModel.update
will fail.For example
service.patch(1, { deletedAt: new Date() })
will update the record, but will then throwNotFound
due to this line:feathers-sequelize/src/adapter.ts
Line 346 in 46af5bd
I am not sure if this library can accomplish this. The developer should not be using patch/update to remove. Note error will still happen if using the underscore or dollar methods too. We could probably inspect the
Model
to determine the paranoid setting and deleted key, but thats super complicated.I don't know if this should be fixed or documented, but I wanted to capture it here.
The text was updated successfully, but these errors were encountered: