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

feat(supabase): add support for between in dataProvider. maps values to gte & lte. #6206

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

Sergio16T
Copy link
Contributor

@Sergio16T Sergio16T commented Jul 29, 2024

Bugs / Features

What is the current behavior?

Current Supabase data provider does not support between date ranges.

When providing an initial filter with a between operator to useTable Hook an error occurs.

What is the new behavior?

Supabase data provider will now map between date ranges from the values array to gte & lte accordingly adding support for between to Supabase data provider.

feat #6119

@Sergio16T Sergio16T requested a review from a team as a code owner July 29, 2024 17:58
Copy link

changeset-bot bot commented Jul 29, 2024

🦋 Changeset detected

Latest commit: c2fd818

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@refinedev/supabase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Sergio16T Sergio16T changed the title feat(supabase): add support for between in dataProvider. maps values to gte & lte. #6119 feat(supabase): add support for between in dataProvider. maps values to gte & lte. Jul 29, 2024
Copy link
Member

@aliemir aliemir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Sergio16T thank you for the quick PR! Looks great, I just left two small comments, let me know if you can work on those 🙏 I'm hoping to include this in our next release this week 🚀

@@ -39,7 +39,26 @@ export const dataProvider = (
});

filters?.map((item) => {
generateFilter(item, query);
if (item.operator === "between") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think moving this to generateFilter (packages/supabase/src/utils/generateFilter.ts) will be better for consistency.

{
field: item.field,
operator: "gte",
value: item.value[0],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also can we add a small condition to check item.value is an array with length of 2 and if not throw an error 🤔

@Sergio16T
Copy link
Contributor Author

Hi @aliemir thank you for the feedback to PR! I've updated the PR with the requested changes 🚀

Copy link
Member

@aliemir aliemir left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the update @Sergio16T! 🚀

@aliemir aliemir changed the base branch from master to releases/august July 30, 2024 12:31
@aliemir aliemir merged commit 399ff2f into refinedev:releases/august Jul 30, 2024
12 checks passed
@aliemir aliemir mentioned this pull request Jul 30, 2024
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

Successfully merging this pull request may close these issues.

[FEAT] @refinedev/supabase missing support for date ranges and "between" filter operator
3 participants