GraphQL: Optimize queries, fixes some null returns (on object), fix stitched GraphQLUpload (#6709)

* Optimize query, fixes some null returns, fix stitched GraphQLUpload

* Fix authData key selection

* Prefer Iso string since other GraphQL solutions use this format

* fix tests

Co-authored-by: Antonio Davi Macedo Coelho de Castro <adavimacedo@gmail.com>
This commit is contained in:
Antoine Cormouls
2020-10-02 00:19:26 +02:00
committed by GitHub
parent 929c4e1b0d
commit 62048260c9
32 changed files with 1533 additions and 1161 deletions

View File

@@ -5,8 +5,16 @@ const createObject = async (className, fields, config, auth, info) => {
fields = {};
}
return (await rest.create(config, auth, className, fields, info.clientSDK, info.context))
.response;
return (
await rest.create(
config,
auth,
className,
fields,
info.clientSDK,
info.context
)
).response;
};
const updateObject = async (
@@ -21,15 +29,17 @@ const updateObject = async (
fields = {};
}
return (await rest.update(
config,
auth,
className,
{ objectId },
fields,
info.clientSDK,
info.context
)).response;
return (
await rest.update(
config,
auth,
className,
{ objectId },
fields,
info.clientSDK,
info.context
)
).response;
};
const deleteObject = async (className, objectId, config, auth, info) => {

View File

@@ -7,7 +7,7 @@ import { transformQueryInputToParse } from '../transformers/query';
/* eslint-disable*/
const needToGetAllKeys = (fields, keys, parseClasses) =>
keys
? keys.split(',').some((keyName) => {
? keys.split(',').some(keyName => {
const key = keyName.split('.');
if (fields[key[0]]) {
if (fields[key[0]].type === 'Pointer') {
@@ -19,7 +19,11 @@ const needToGetAllKeys = (fields, keys, parseClasses) =>
// Current sub key is not custom
return false;
}
} else if (!key[1]) {
} else if (
!key[1] ||
fields[key[0]].type === 'Array' ||
fields[key[0]].type === 'Object'
) {
// current key is not custom
return false;
}
@@ -156,7 +160,7 @@ const findObjects = async (
if (
selectedFields.find(
(field) => field.startsWith('edges.') || field.startsWith('pageInfo.')
field => field.startsWith('edges.') || field.startsWith('pageInfo.')
)
) {
if (limit || limit === 0) {