Skip to content

Commit d12ee10

Browse files
committed
Fix more query structure
1 parent b884057 commit d12ee10

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

ClearBlade.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -317,10 +317,10 @@ if (!window.console) {
317317
newObj[key] = value;
318318
var newFilter = {};
319319
newFilter[condition] = [newObj];
320-
if (typeof queryObj.query.filters === 'undefined') {
321-
queryObj.query.filters = [];
320+
if (typeof queryObj.query.FILTERS === 'undefined') {
321+
queryObj.query.FILTERS = [];
322322
}
323-
queryObj.query.filters.push(newFilter);
323+
queryObj.query.FILTERS.push(newFilter);
324324
};
325325

326326
var addSortToQuery = function(queryObj, direction, column) {
@@ -559,11 +559,11 @@ if (!window.console) {
559559
if (callback === undefined) {
560560
callback = _query;
561561
query = {
562-
OR: []
562+
FILTERS: []
563563
};
564-
query = 'query='+ _parseQuery(query.OR);
564+
query = 'query='+ _parseQuery(query);
565565
} else {
566-
query = 'query='+ _parseQuery(_query.OR);
566+
query = 'query='+ _parseQuery(_query.query);
567567
}
568568

569569
var reqOptions = {
@@ -828,8 +828,8 @@ if (!window.console) {
828828
* //will match if an item has an attribute 'name' that is equal to 'John' or 'Jim'
829829
*/
830830
ClearBlade.Query.prototype.or = function (that) {
831-
for (var i = 0; i < that.query.filters.length; i++) {
832-
this.query.filters.push(that.query.filters[i]);
831+
for (var i = 0; i < that.query.FILTERS.length; i++) {
832+
this.query.FILTERS.push(that.query.FILTERS[i]);
833833
}
834834
return this;
835835
};
@@ -900,7 +900,6 @@ if (!window.console) {
900900
qs: 'query=' + _parseQuery(this.query)
901901
};
902902

903-
console.log(reqOptions.qs);
904903
if (this.collection === undefined || this.collection === "") {
905904
throw new Error("No collection was defined");
906905
} else {

0 commit comments

Comments
 (0)