Saasli / saasli-backend

Documentation
https://saasli.github.io/docs/
0 stars 0 forks source link

[salesforce-rest][salesforce-bulk] Both Services are unable to handle 'OR' conditions #60

Open godd9170 opened 7 years ago

godd9170 commented 7 years ago

If you want to 'OR' the clause array you send over to the salesforce 'GET' endpoints, you're SOL. We currently hard code like this:

def whereify(self, array, object):
        out = ""
        for clause in array:
            if clause['op'] == "IN": #If the op type is 'IN' we don't want to wrap our array in quotes.
                out += "AND %s %s %s " % (clause['a'], clause['op'], clause['b'])
            else:
                out += "AND %s %s %s " % (clause['a'], clause['op'], "{}".format(clause['b']) if self.isnum(clause['b']) else "'{}'".format(clause['b'])) 
        return out[4:]

We need to either offer a more elegant means of allowing the user to specify ANDs vs. ORs in the clauses.

OR we just abandon the whole modular portion of this and take the entire query as a parameter.

godd9170 commented 7 years ago

I'm inclined to write an additional method for each that takes the full query, so not to interfere with anything else we've written.