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

Support complex filter when save item #713

Open
KevinToala opened this issue Jan 11, 2025 · 0 comments
Open

Support complex filter when save item #713

KevinToala opened this issue Jan 11, 2025 · 0 comments

Comments

@KevinToala
Copy link

KevinToala commented Jan 11, 2025

We recently needed to add a ComplexFilter to a condition when saving an object because we required an OR condition. However, at the moment, the save function only supports the Filter type. When using conditions with the save function, if we provide a Filter structure, it only builds an AND condition. Upon reviewing the code, I found that it could actually support the ComplexFilter type. I tested it with the following code, avoiding type errors, and it worked.

  await courierOrderLock.save({
    // @ts-expect-error: use complex filter
    operator: "put",
    // @ts-expect-error: use complex filter
    conditions: [
      {
        pk: ["not exists"],
      },
      "OR",
      {
        nextAllowedAt: ["<", new Date()],
      },
    ],
  });

I believe an update should be made so that the save() function officially supports ComplexFilter as a parameter.

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

1 participant