refactor(GraphQL): Pointer constraint input type as ID (#6020)

* refactor(GraphQL): Pointer constraint input type as ID

Redefines the Pointer constraint input type from a custom scalar to
a simple ID.

* fix: PR review requested changes
This commit is contained in:
Douglas Muraoka
2019-09-04 19:46:18 -03:00
committed by Antonio Davi Macedo Coelho de Castro
parent 34f1bf384d
commit f9b77c1bc7
5 changed files with 68 additions and 109 deletions

View File

@@ -3384,11 +3384,7 @@ describe('ParseGraphQLServer', () => {
OR: [
{
pointerToUser: {
equalTo: {
__type: 'Pointer',
className: '_User',
objectId: user5.id,
},
equalTo: user5.id,
},
},
{
@@ -3413,6 +3409,40 @@ describe('ParseGraphQLServer', () => {
).toEqual(['someValue1', 'someValue3']);
});
it('should support in pointer operator using class specific query', async () => {
await prepareData();
await parseGraphQLServer.parseGraphQLSchema.databaseController.schemaCache.clear();
const result = await apolloClient.query({
query: gql`
query FindSomeObjects($where: GraphQLClassWhereInput) {
graphQLClasses(where: $where) {
results {
someField
}
}
}
`,
variables: {
where: {
pointerToUser: {
in: [user5.id],
},
},
},
context: {
headers: {
'X-Parse-Master-Key': 'test',
},
},
});
const { results } = result.data.graphQLClasses;
expect(results.length).toBe(1);
expect(results[0].someField).toEqual('someValue3');
});
it('should support OR operation', async () => {
await prepareData();
@@ -3558,11 +3588,7 @@ describe('ParseGraphQLServer', () => {
OR: [
{
pointerToUser: {
equalTo: {
__type: 'Pointer',
className: '_User',
objectId: user5.id,
},
equalTo: user5.id,
},
},
{
@@ -3614,11 +3640,7 @@ describe('ParseGraphQLServer', () => {
OR: [
{
pointerToUser: {
equalTo: {
__type: 'Pointer',
className: '_User',
objectId: user5.id,
},
equalTo: user5.id,
},
},
{