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): filter array column by array (ina and nina operators) #5922

Open
wants to merge 8 commits into
base: releases/june
Choose a base branch
from

Conversation

issa012
Copy link
Contributor

@issa012 issa012 commented May 6, 2024

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

No ina and nina

What is the new behavior?

Now it is possible to filter using ina and nina CRUD operators in supabase data provider. It allows for filtering array columns by matching all values inside array.
fixes #5902

Notes for reviewers

@issa012 issa012 requested a review from a team as a code owner May 6, 2024 13:21
Copy link

changeset-bot bot commented May 6, 2024

🦋 Changeset detected

Latest commit: bdd99ee

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

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

Copy link

nx-cloud bot commented May 6, 2024

☁️ Nx Cloud Report

CI is running/has finished running commands for commit bdd99ee. As they complete they will appear below. Click to see the status, the terminal output, and the build insights.

📂 See all runs for this CI Pipeline Execution


✅ Successfully ran 60 targets

Sent with 💌 from NxCloud.

@issa012 issa012 changed the title Iss5902 [FEAT]: Supabase Data Provider should filter array column by array May 6, 2024
@BatuhanW BatuhanW added this to the June Release milestone May 6, 2024
Copy link

netlify bot commented May 9, 2024

Deploy Preview for refine-video-club ready!

Name Link
🔨 Latest commit 095e45f
🔍 Latest deploy log https://app.netlify.com/sites/refine-video-club/deploys/663c6d300e5394000829c11a
😎 Deploy Preview https://deploy-preview-5922--refine-video-club.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@alicanerdurmaz
Copy link
Member

alicanerdurmaz commented May 9, 2024

Hello, @issa012. Thanks for the PR 🚀

As you can see, the CI is failing but this is not related to the changes you made. First, I will solve this problem in another PR and then we will review your PR.

@aliemir
Copy link
Member

aliemir commented May 10, 2024

Failing CI will be resolved after #5937 is merged.

@aliemir aliemir changed the title [FEAT]: Supabase Data Provider should filter array column by array feat(supabase): filter array column by array (ina and nina operators) May 13, 2024
@aliemir aliemir changed the base branch from master to releases/june May 13, 2024 17:47
Comment on lines +47 to 52
if (item.operator === "ina" || item.operator === "nina")
return `${item.field}.${mapOperator(
item.operator,
)}.${`{${item.value.map((val: any) => `"${val}"`).join(",")}}`}`;

return `${item.field}.${mapOperator(item.operator)}.${item.value}`;
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 this is more readable

Suggested change
if (item.operator === "ina" || item.operator === "nina")
return `${item.field}.${mapOperator(
item.operator,
)}.${`{${item.value.map((val: any) => `"${val}"`).join(",")}}`}`;
return `${item.field}.${mapOperator(item.operator)}.${item.value}`;
let value = item.value;
if (item.operator === "ina" || item.operator === "nina") {
value = `{${item.value.map((val: any) => `"${val}"`).join(",")}}`;
}
return `${item.field}.${mapOperator(item.operator)}.${value}`;

.reply(
200,
[
"1f8b08000000000000039c54cb8e1c4510bcf315a9ba70a0bbd53dcfde3e820059b22d4b36e6e0b1504e55ee4ce27af45666adb442fc3baa9e5def030ec0b1bbf2118a888c4f7f1876661a1a6333a192fb0dd54c66d5af366dbf6dfbdd87619856fba91fba7ddfafaf76dff5fdd4f7a631caeac94ce67b8ff60bbc939493b23d33c26bb6678aa631e2cbc94c6637e07ae8c7abd68e5bd76e46ec5bdc1ca9755b67696baf76c71d9ac6d8149562ddfe2a2a9d288372b4ec4a54c0a804b7e4816729a183771949282a1c3d46c70a1e2d4746a08cdac14712e563f12580908380a788800ab1440b3685905c82d9a35dca0f877838c497233b788b0162f11e3b7840349323f8bd88a6e671e589b47982f5fe9bc25ca4626e96aefb2d6f523e32cc29abb2a60c3e650ac00e3c9f4addf4bec84cd1b10841ca1133814d51e8a6a08227ab452a1c2051c82c451ac062eb2821d7806616e59b42c0f12b0861050c159550e82ad5a8744af9ee9533d3be318a2731d327e3f99a44ef3c99c69c09bd9eabce196fc99bc65ca7e44c6332599e494c6366ca9222d637257b8ec9a7d35d2d443973aa06381216adbfe40b478bb90e26572ceae53d5054f470bfeb736338e089c44cc6fcd9c0377031e7ee1fcdb969579b0fc37a5af5d3d077abbe5faff67f33e7afe895f2b702efc99de89925afc6ed75df6efbfdd86eae1cb523b9b15dadfb61b4dbf538b8dd334bfe905120f0226503013d4941870bcb1c66ca8e49a152fc60afdbe2e7a2a8d45c0cb3a8f660d7e235b325018a1c3a787d7141f536b8e4ab985f255bd4b74a5a28033a9e592cc71390677da9e5f09fb47cc277b5f913c657ff9ff19f6b1fbcf3c851e0278f2acf99df2259b73ff6adbd5e8deda63f6e5a749bb1ddbb8ddded87715cefe94518c0192d9cf1c88af52a668f4a088ead9620dac18fca18e01a8be56311b0254b1128396207bf2828795fa43bc4437c5baf198a2e3151af2e60c92c8f5a0179aaa6ac19b31407b8c5ccf5e62ebdd768d9b3f0326e31454cb15e392b44b21059f8c9b8986209e1ae8337489622ca939cf0688bd4545aba3bf8c8b7",
Copy link
Member

Choose a reason for hiding this comment

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

output should be JSON like this:
image

As you can see here, when you add this header, the output should be a JSON

const supabaseClient = createClient(SUPABASE_URL, SUPABASE_KEY, {
  global: {
    headers: {
      "Accept-Encoding": "identity",
    },
  },
});

@@ -285,6 +285,72 @@ describe("filtering", () => {
expect(total).toBe(2);
});

it("or operator should work correctly", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
it("or operator should work correctly", async () => {
it("ina operator should work with or", async () => {

@@ -285,6 +285,72 @@ describe("filtering", () => {
expect(total).toBe(2);
});

it("or operator should work correctly", async () => {
Copy link
Member

Choose a reason for hiding this comment

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

Can you also add nina version of this, please?

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]: Supabase Data Provider should filter array column by array
4 participants