feat(adapter): Add patch data type to adapters and refactor AdapterBase usage#2906
Merged
feat(adapter): Add patch data type to adapters and refactor AdapterBase usage#2906
Conversation
✅ Deploy Preview for feathers-dove ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
| async create(data: D[], params?: P): Promise<T[]> | ||
| async create(data: D | D[], params?: P): Promise<T | T[]> { | ||
| if (Array.isArray(data) && !this.allowsMulti('create', params)) { | ||
| throw new MethodNotAllowed('Can not create multiple entries') |
marshallswain
approved these changes
Dec 4, 2022
Member
marshallswain
left a comment
There was a problem hiding this comment.
Looks good. Will we make sanitizeQuery conditionally run in another PR, or did I miss it in this one?
Member
Author
3 tasks
This was referenced Dec 9, 2022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request adds the ability to use a
PatchDatatype in the adapters which may be different than the usual data type.It also refactors the
AdapterBaseto remove the confusing and convoluted$prefixed service methods. Instead an adapter just implements the underscored service methods as before. While for the top level usage backwards compatible this may be a breaking change in some hopefully still uncommon instances but it reduces a lot of the complexity when implementing a database adapter.You can still extend directly from the adapter class to implement the actual service methods with your own signatures and return types. This will circumvent the legacy query sanitisation which is now done with query schemas anyway.