GraphQL: Handle properly keys for pointer fields (#6499)
* Fix Unknow type bug on overloaded types * check args too * Additional fix to detect custom fields on pointer
This commit is contained in:
@@ -31,9 +31,7 @@ const load = parseGraphQLSchema => {
|
||||
config,
|
||||
auth,
|
||||
info,
|
||||
parseGraphQLSchema.parseClasses.find(
|
||||
({ className }) => type === className
|
||||
)
|
||||
parseGraphQLSchema.parseClasses
|
||||
)),
|
||||
};
|
||||
} catch (e) {
|
||||
|
||||
@@ -114,7 +114,8 @@ const load = function(
|
||||
);
|
||||
const needToGetAllKeys = objectsQueries.needToGetAllKeys(
|
||||
parseClass.fields,
|
||||
keys
|
||||
keys,
|
||||
parseGraphQLSchema.parseClasses
|
||||
);
|
||||
let optimizedObject = {};
|
||||
if (needGet && !needToGetAllKeys) {
|
||||
@@ -128,7 +129,7 @@ const load = function(
|
||||
config,
|
||||
auth,
|
||||
info,
|
||||
parseClass
|
||||
parseGraphQLSchema.parseClasses
|
||||
);
|
||||
} else if (needToGetAllKeys) {
|
||||
optimizedObject = await objectsQueries.getObject(
|
||||
@@ -141,7 +142,7 @@ const load = function(
|
||||
config,
|
||||
auth,
|
||||
info,
|
||||
parseClass
|
||||
parseGraphQLSchema.parseClasses
|
||||
);
|
||||
}
|
||||
return {
|
||||
@@ -232,7 +233,8 @@ const load = function(
|
||||
);
|
||||
const needToGetAllKeys = objectsQueries.needToGetAllKeys(
|
||||
parseClass.fields,
|
||||
keys
|
||||
keys,
|
||||
parseGraphQLSchema.parseClasses
|
||||
);
|
||||
let optimizedObject = {};
|
||||
if (needGet && !needToGetAllKeys) {
|
||||
@@ -246,7 +248,7 @@ const load = function(
|
||||
config,
|
||||
auth,
|
||||
info,
|
||||
parseClass
|
||||
parseGraphQLSchema.parseClasses
|
||||
);
|
||||
} else if (needToGetAllKeys) {
|
||||
optimizedObject = await objectsQueries.getObject(
|
||||
@@ -259,7 +261,7 @@ const load = function(
|
||||
config,
|
||||
auth,
|
||||
info,
|
||||
parseClass
|
||||
parseGraphQLSchema.parseClasses
|
||||
);
|
||||
}
|
||||
return {
|
||||
@@ -337,7 +339,7 @@ const load = function(
|
||||
config,
|
||||
auth,
|
||||
info,
|
||||
parseClass
|
||||
parseGraphQLSchema.parseClasses
|
||||
);
|
||||
}
|
||||
await objectsMutations.deleteObject(
|
||||
|
||||
@@ -14,7 +14,14 @@ const getParseClassQueryConfig = function(
|
||||
return (parseClassConfig && parseClassConfig.query) || {};
|
||||
};
|
||||
|
||||
const getQuery = async (parseClass, _source, args, context, queryInfo) => {
|
||||
const getQuery = async (
|
||||
parseClass,
|
||||
_source,
|
||||
args,
|
||||
context,
|
||||
queryInfo,
|
||||
parseClasses
|
||||
) => {
|
||||
let { id } = args;
|
||||
const { options } = args;
|
||||
const { readPreference, includeReadPreference } = options || {};
|
||||
@@ -39,7 +46,7 @@ const getQuery = async (parseClass, _source, args, context, queryInfo) => {
|
||||
config,
|
||||
auth,
|
||||
info,
|
||||
parseClass
|
||||
parseClasses
|
||||
);
|
||||
};
|
||||
|
||||
@@ -80,7 +87,14 @@ const load = function(
|
||||
),
|
||||
async resolve(_source, args, context, queryInfo) {
|
||||
try {
|
||||
return await getQuery(parseClass, _source, args, context, queryInfo);
|
||||
return await getQuery(
|
||||
parseClass,
|
||||
_source,
|
||||
args,
|
||||
context,
|
||||
queryInfo,
|
||||
parseGraphQLSchema.parseClasses
|
||||
);
|
||||
} catch (e) {
|
||||
parseGraphQLSchema.handleError(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user