mirror of
https://github.com/strapi/strapi.git
synced 2026-01-07 20:58:16 +00:00
First working version of graphql rework w/ the new plugin API
This commit is contained in:
parent
21045d8936
commit
2ea04f1cd4
7
packages/plugins/graphql/server/bootstrap.js
vendored
7
packages/plugins/graphql/server/bootstrap.js
vendored
@ -32,7 +32,10 @@ module.exports = async strapi => {
|
||||
// Initialize loaders for this request.
|
||||
context: ({ ctx }) => {
|
||||
// TODO: set loaders in the context not globally
|
||||
strapi.plugins.graphql.services.old['data-loaders'].initializeLoader();
|
||||
strapi
|
||||
.plugin('graphql')
|
||||
.service('old')
|
||||
['data-loaders'].initializeLoader();
|
||||
|
||||
return {
|
||||
context: ctx,
|
||||
@ -80,8 +83,6 @@ module.exports = async strapi => {
|
||||
path: config.endpoint,
|
||||
});
|
||||
|
||||
console.log(config.endpoint);
|
||||
|
||||
// Register destroy behavior
|
||||
strapi.plugins.graphql.destroy = async () => {
|
||||
await server.stop();
|
||||
|
||||
@ -211,7 +211,7 @@ const addMediaAttribute = options => {
|
||||
context: { strapi },
|
||||
} = options;
|
||||
|
||||
const fileContentType = strapi.plugin('upload').contentType('file');
|
||||
const fileContentType = strapi.plugin('upload').contentType('file').schema;
|
||||
|
||||
const resolve = buildAssociationResolver({
|
||||
contentTypeUID: contentType.uid,
|
||||
|
||||
@ -90,9 +90,9 @@ const getEnumName = (contentType, attributeName) => {
|
||||
const getTypeName = contentType => {
|
||||
const plugin = get('plugin', contentType);
|
||||
const modelName = get('modelName', contentType);
|
||||
const singularName = get('schema.info.singularName', contentType);
|
||||
const singularName = get('info.singularName', contentType);
|
||||
|
||||
const transformedPlugin = camelCase(plugin);
|
||||
const transformedPlugin = upperFirst(camelCase(plugin));
|
||||
const transformedModelName = upperFirst(singularName || toSingular(modelName));
|
||||
|
||||
return `${transformedPlugin}${transformedModelName}`;
|
||||
@ -243,6 +243,7 @@ const getMorphRelationTypeName = (contentType, attributeName) => {
|
||||
* @return {function(*=): string}
|
||||
*/
|
||||
const buildCustomTypeNameGenerator = (options = {}) => {
|
||||
// todo[v4]: use singularName & pluralName is available
|
||||
const { prefix = '', suffix = '', plurality = 'singular', firstLetterCase = 'upper' } = options;
|
||||
|
||||
if (!['plural', 'singular'].includes(plurality)) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user