You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 20, 2018. It is now read-only.
consterrors=require('feathers-errors');functiondisableMultiRecordChange(){returnfunction(hook){if(!hook.id){thrownewerrors.BadRequest('Multi-record changes are not permitted.');}else{returnhook;}};}
It would be a breaking change but I've been wondering about disabling it by default in general. The hook would definitely be the non-breaking way to do this. Only change I'd recommend is to check for hook.id === null since hook.id = 0 would throw a bad request otherwise as well:
consterrors=require('feathers-errors');functiondisableMultiRecordChange(){returnfunction(hook){if(hook.id===null){thrownewerrors.BadRequest('Multi-record changes are not permitted.');}else{returnhook;}};}
A hook that throws an error (a
400
error may be most appropriate) if theid
isnull
for theupdate
,patch
, andremove
service methods.This seems generic enough to be valuable to the community at large.
The text was updated successfully, but these errors were encountered: