woylie/flop

How to pass parameters to Repo

volkerholloh opened this issue · 2 comments

Hi there,

I need a helping hand with a problem I am facing.

I want to pass the parameters "skip_org_id: true" to the Repo like in an other query: Repo.all(User, skip_org_id: true). It's a security measure due to multitenancy.

How can I do this in Flop? I tried to to add it to the flop_opts, which worked in older versions of Flop:

...
    flop_opts = Keyword.merge(flop_opts, skip_org_id: true)
    Flop.validate_and_run(query, query_params, flop_opts)
...

I looked at the code and there are only a couple of options for use.

Any idea?

Your help is much appreciated and thank you @woylie for this package.

Kind regards,
Volker

Hey there,

try this:

flop_opts = Keyword.put(flop_opts, :query_opts, [skip_org_id: true])
Flop.validate_and_run(query, query_params, flop_opts)

Boom, it works! Thank you!