I have an ObjectionJS query that is built dynamically based on a bunch of conditionals passed in.
For example this is the base query
const qb = Job.query(trx).select(id);
then there is are steps like so
if(body.sort)
qb
.leftJoinRelated('client')
.orderBy(client name...)
if(body.filter)
qb
.leftJoinRelated('client')
.whereIn('clientGuid', body.filter)
So when I execute my query pretty much I get an error that reads
table name "client" specified more than once
I am trying to see if there is a clean way for me to check which relations are already added to the query builder instance so that I don't attempt to add them again.