forest-express-sequelize icon indicating copy to clipboard operation
forest-express-sequelize copied to clipboard

fix(smart-field): smart-field search use returned query

Open JustinMartinDev opened this issue 2 years ago • 3 comments

Definition of Done

General

Actually smart-field search use mutation on query params instead of use returned query value as defined in type definition and in doc.

⚠️ My proposal is to use the returned value, but keep mind it will break the search of people using only mutation.

If you want to keep the mutation, update doc to remove the return query and in type definition change return to void

  • [ ] Write an explicit title for the Pull Request, following Conventional Commits specification
  • [ ] Test manually the implemented changes
  • [ ] Validate the code quality (indentation, syntax, style, simplicity, readability)
  • [ ] Ensure that Types have been updated according to your changes (if needed)

Security

  • [ ] Consider the security impact of the changes made

JustinMartinDev avatar Jan 10 '23 14:01 JustinMartinDev

Hello really thanks for your contribution. Indeed there is inconsistency. What was the motivation for your contribution? Did you encounter a bug? 🙏

Scra3 avatar Jan 11 '23 10:01 Scra3

Yes, to avoid any side-effect due to mutation, I created a new object "query" with my additional condition and return it, but my condition was ignored.

After exploring the search-builder, i saw the smart-field search use mutation instead of type definition & doc.

const advancedQuery = {
    ...query,
    where: {
      ...where,
      [Op.and]: [
        {
          ...first,
          [Op.or]: [...first[Op.or], myCondition],
        },
        ...rest,
      ],
    },
  };

JustinMartinDev avatar Jan 11 '23 13:01 JustinMartinDev

We have released a v9 3 months ago and a new node-js agent We will update the documentation so for now we're putting your PR aside, it may come in handy. 🙏

We will update the documentation and the TS interface.

Ty for your contribution.

Scra3 avatar Jan 11 '23 14:01 Scra3