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
base: releases/june
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest 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 |
✅ Deploy Preview for refine-video-club ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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. |
Failing CI will be resolved after #5937 is merged. |
ina
and nina
operators)
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}`; |
There was a problem hiding this comment.
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
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", |
There was a problem hiding this comment.
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:
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 () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 () => { |
There was a problem hiding this comment.
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?
PR Checklist
Please check if your PR fulfills the following requirements:
Bugs / Features
What is the current behavior?
No
ina
andnina
What is the new behavior?
Now it is possible to filter using
ina
andnina
CRUD operators in supabase data provider. It allows for filtering array columns by matching all values inside array.fixes #5902
Notes for reviewers