Skip to content

Commit d8e3fdb

Browse files
authored
Merge branch 'alpha' into fix-merge#7661
2 parents 52d9927 + a359c02 commit d8e3fdb

File tree

8 files changed

+73
-9
lines changed

8 files changed

+73
-9
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,21 @@ jobs:
7272
- run: npm run madge:circular
7373
check-docker:
7474
name: Docker Build
75-
timeout-minutes: 5
75+
timeout-minutes: 15
7676
runs-on: ubuntu-18.04
7777
steps:
78-
- uses: actions/checkout@v2
78+
- name: Checkout repository
79+
uses: actions/checkout@v2
80+
- name: Set up QEMU
81+
id: qemu
82+
uses: docker/setup-qemu-action@v1
83+
- name: Set up Docker Buildx
84+
uses: docker/setup-buildx-action@v1
7985
- name: Build docker image
8086
uses: docker/build-push-action@v2
87+
with:
88+
context: .
89+
platforms: linux/amd64
8190
check-lock-file-version:
8291
name: NPM Lock File Version
8392
timeout-minutes: 5

.github/workflows/release-automated.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ jobs:
7878
uses: docker/build-push-action@v2
7979
with:
8080
context: .
81-
platforms: linux/amd64
81+
platforms: linux/amd64, linux/arm/v6, linux/arm/v7, linux/arm64/v8
8282
push: ${{ github.event_name != 'pull_request' }}
8383
tags: ${{ steps.meta.outputs.tags }}
8484
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,30 @@
1+
############################################################
12
# Build stage
3+
############################################################
24
FROM node:lts-alpine as build
35

46
RUN apk update; \
57
apk add git;
68
WORKDIR /tmp
9+
10+
# Copy package.json first to benefit from layer caching
711
COPY package*.json ./
812

9-
# Copy local dependencies for CI tests
10-
COPY spec/dependencies spec/dependencies
13+
# Copy src to have config files for install
14+
COPY . .
1115

16+
# Clean npm cache; added to fix an issue with the install process
1217
RUN npm cache clean --force
18+
19+
# Install all dependencies
1320
RUN npm ci
14-
COPY . .
21+
22+
# Run build steps
1523
RUN npm run build
1624

25+
############################################################
1726
# Release stage
27+
############################################################
1828
FROM node:lts-alpine as release
1929

2030
RUN apk update; \
@@ -26,6 +36,7 @@ WORKDIR /parse-server
2636

2737
COPY package*.json ./
2838

39+
# Clean npm cache; added to fix an issue with the install process
2940
RUN npm cache clean --force
3041
RUN npm ci --production --ignore-scripts
3142

changelogs/CHANGELOG_alpha.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# [5.0.0-alpha.3](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.2...5.0.0-alpha.3) (2021-10-29)
2+
3+
4+
### Bug Fixes
5+
6+
* combined `and` query with relational query condition returns incorrect results ([#7593](https://github.com/parse-community/parse-server/issues/7593)) ([174886e](https://github.com/parse-community/parse-server/commit/174886e385e091c6bbd4a84891ef95f80b50d05c))
7+
18
# [5.0.0-alpha.2](https://github.com/parse-community/parse-server/compare/5.0.0-alpha.1...5.0.0-alpha.2) (2021-10-27)
29

310

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "parse-server",
3-
"version": "5.0.0-alpha.2",
3+
"version": "5.0.0-alpha.3",
44
"description": "An express module providing a Parse-compatible API server",
55
"main": "lib/index.js",
66
"repository": {

spec/CloudCode.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3524,4 +3524,23 @@ describe('sendEmail', () => {
35243524
'Failed to send email because no mail adapter is configured for Parse Server.'
35253525
);
35263526
});
3527+
3528+
it('should have object found with nested relational data query', async () => {
3529+
const obj1 = Parse.Object.extend('TestObject');
3530+
const obj2 = Parse.Object.extend('TestObject2');
3531+
let item2 = new obj2();
3532+
item2 = await item2.save();
3533+
let item1 = new obj1();
3534+
const relation = item1.relation('rel');
3535+
relation.add(item2);
3536+
item1 = await item1.save();
3537+
Parse.Cloud.beforeFind('TestObject', req => {
3538+
const additionalQ = new Parse.Query('TestObject');
3539+
additionalQ.equalTo('rel', item2);
3540+
return Parse.Query.and(req.query, additionalQ);
3541+
});
3542+
const q = new Parse.Query('TestObject');
3543+
const res = await q.first();
3544+
expect(res.id).toEqual(item1.id);
3545+
});
35273546
});

src/Controllers/DatabaseController.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -971,6 +971,18 @@ class DatabaseController {
971971
return Promise.resolve(query);
972972
});
973973
}
974+
if (query['$and']) {
975+
const ors = query['$and'];
976+
return Promise.all(
977+
ors.map((aQuery, index) => {
978+
return this.reduceInRelation(className, aQuery, schema).then(aQuery => {
979+
query['$and'][index] = aQuery;
980+
});
981+
})
982+
).then(() => {
983+
return Promise.resolve(query);
984+
});
985+
}
974986

975987
const promises = Object.keys(query).map(key => {
976988
const t = schema.getExpectedType(className, key);
@@ -1049,7 +1061,13 @@ class DatabaseController {
10491061
})
10501062
);
10511063
}
1052-
1064+
if (query['$and']) {
1065+
return Promise.all(
1066+
query['$and'].map(aQuery => {
1067+
return this.reduceRelationKeys(className, aQuery, queryOptions);
1068+
})
1069+
);
1070+
}
10531071
var relatedTo = query['$relatedTo'];
10541072
if (relatedTo) {
10551073
return this.relatedIds(

0 commit comments

Comments
 (0)