Skip to content
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

getFirstListItem first arg is typed for unserialized filter #38

Open
gavry opened this issue May 16, 2024 · 1 comment
Open

getFirstListItem first arg is typed for unserialized filter #38

gavry opened this issue May 16, 2024 · 1 comment

Comments

@gavry
Copy link

gavry commented May 16, 2024

Hi! Thanks for the awesome library - I much prefer it to the more popular one tbh!

getFirstListItem has typings that makes the first arg ("filter") of type Filter, but the actual method takes in a string and passes it directly to the parent service as the string. This results in an error from pocketbase where the query is incomplete/malformed (400 error).

Edit: forgot to paste reference:

getFirstListItem(filter: string, options?: SendOptions) {
return this.service.getFirstListItem(
filter,
this.prepareOptions(options)
);
}

I assume the solution is to:

  • Check if it's of type string
  • If yes, pass directly
  • If no, serialize it and pass it

Happy to open a pull request if that sounds good to you! Thanks again!

@david-plugge
Copy link
Owner

Hey, glad you enjoy it and sorry for my late reply!

Good catch, this should only happen when you pass in a filter like ['date', '>=', '2023-01-01'] as the filter methods always return a string. Feel free to create a PR :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants