Hi!
I am trying to figure out how to rewrite/change/utilize functions such as selectList (and others), so that it would by default add a where statement such as ..."where company_id = 3". This would be applied to all tables that need to have their records being shared by multiple tenants referred to by company_id or equivalent.
The type of the selectList function is as follows:
selectListSecure :: forall record backend (m :: * -> *). (MonadIO m, PersistQueryRead backend,
PersistRecordBackend record backend) => [Filter record] -> [SelectOpt record] -> ReaderT backend m [Entity record]
I was wondering if I could somehow figure out the type of the record in my own version of the function, so that I could add a new filter such as [MyId ==. myid] to the filter and let the db action happen after that?
Somehow I have the feeling that we cannot figure out (use pattern matching) to get that type out and create the filters in a function with such a signature, but be need to do something else? How would you do it?
Regards
Juuso
Regards
Juuso