Skip to content

Commit ed6a764

Browse files
authored
Merge branch 'alpha' into moumouls/fix-graphql-realy
2 parents 6bde617 + c789f6c commit ed6a764

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

package-lock.json

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"cors": "2.8.5",
3333
"deepcopy": "2.1.0",
3434
"express": "4.17.1",
35-
"follow-redirects": "1.14.4",
35+
"follow-redirects": "1.14.5",
3636
"graphql": "15.7.0",
3737
"graphql-list-fields": "2.0.2",
3838
"graphql-relay": "0.7.0",

spec/CloudCode.spec.js

+19-19
Original file line numberDiff line numberDiff line change
@@ -1999,6 +1999,25 @@ describe('beforeFind hooks', () => {
19991999
});
20002000
});
20012001

2002+
it('should have object found with nested relational data query', async () => {
2003+
const obj1 = Parse.Object.extend('TestObject');
2004+
const obj2 = Parse.Object.extend('TestObject2');
2005+
let item2 = new obj2();
2006+
item2 = await item2.save();
2007+
let item1 = new obj1();
2008+
const relation = item1.relation('rel');
2009+
relation.add(item2);
2010+
item1 = await item1.save();
2011+
Parse.Cloud.beforeFind('TestObject', req => {
2012+
const additionalQ = new Parse.Query('TestObject');
2013+
additionalQ.equalTo('rel', item2);
2014+
return Parse.Query.and(req.query, additionalQ);
2015+
});
2016+
const q = new Parse.Query('TestObject');
2017+
const res = await q.first();
2018+
expect(res.id).toEqual(item1.id);
2019+
});
2020+
20022021
it('should use the modified exclude query', async () => {
20032022
Parse.Cloud.beforeFind('MyObject', req => {
20042023
const q = req.query;
@@ -3516,23 +3535,4 @@ describe('sendEmail', () => {
35163535
'Failed to send email because no mail adapter is configured for Parse Server.'
35173536
);
35183537
});
3519-
3520-
it('should have object found with nested relational data query', async () => {
3521-
const obj1 = Parse.Object.extend('TestObject');
3522-
const obj2 = Parse.Object.extend('TestObject2');
3523-
let item2 = new obj2();
3524-
item2 = await item2.save();
3525-
let item1 = new obj1();
3526-
const relation = item1.relation('rel');
3527-
relation.add(item2);
3528-
item1 = await item1.save();
3529-
Parse.Cloud.beforeFind('TestObject', req => {
3530-
const additionalQ = new Parse.Query('TestObject');
3531-
additionalQ.equalTo('rel', item2);
3532-
return Parse.Query.and(req.query, additionalQ);
3533-
});
3534-
const q = new Parse.Query('TestObject');
3535-
const res = await q.first();
3536-
expect(res.id).toEqual(item1.id);
3537-
});
35383538
});

src/Controllers/DatabaseController.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -972,9 +972,9 @@ class DatabaseController {
972972
});
973973
}
974974
if (query['$and']) {
975-
const ors = query['$and'];
975+
const ands = query['$and'];
976976
return Promise.all(
977-
ors.map((aQuery, index) => {
977+
ands.map((aQuery, index) => {
978978
return this.reduceInRelation(className, aQuery, schema).then(aQuery => {
979979
query['$and'][index] = aQuery;
980980
});

0 commit comments

Comments
 (0)