GraphQL: Allow true GraphQL Schema Customization (#6360)
* Allow real GraphQL Schema via ParseServer.start * wip * working * tests ok * add tests about enum/input use case * Add async function based merge * Better naming * remove useless condition
This commit is contained in:
@@ -14,7 +14,7 @@ const getParseClassQueryConfig = function(
|
||||
return (parseClassConfig && parseClassConfig.query) || {};
|
||||
};
|
||||
|
||||
const getQuery = async (className, _source, args, context, queryInfo) => {
|
||||
const getQuery = async (parseClass, _source, args, context, queryInfo) => {
|
||||
let { id } = args;
|
||||
const { options } = args;
|
||||
const { readPreference, includeReadPreference } = options || {};
|
||||
@@ -23,14 +23,14 @@ const getQuery = async (className, _source, args, context, queryInfo) => {
|
||||
|
||||
const globalIdObject = fromGlobalId(id);
|
||||
|
||||
if (globalIdObject.type === className) {
|
||||
if (globalIdObject.type === parseClass.className) {
|
||||
id = globalIdObject.id;
|
||||
}
|
||||
|
||||
const { keys, include } = extractKeysAndInclude(selectedFields);
|
||||
|
||||
return await objectsQueries.getObject(
|
||||
className,
|
||||
parseClass.className,
|
||||
id,
|
||||
keys,
|
||||
include,
|
||||
@@ -38,7 +38,8 @@ const getQuery = async (className, _source, args, context, queryInfo) => {
|
||||
includeReadPreference,
|
||||
config,
|
||||
auth,
|
||||
info
|
||||
info,
|
||||
parseClass
|
||||
);
|
||||
};
|
||||
|
||||
@@ -79,7 +80,7 @@ const load = function(
|
||||
),
|
||||
async resolve(_source, args, context, queryInfo) {
|
||||
try {
|
||||
return await getQuery(className, _source, args, context, queryInfo);
|
||||
return await getQuery(parseClass, _source, args, context, queryInfo);
|
||||
} catch (e) {
|
||||
parseGraphQLSchema.handleError(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user