System Information
- @strapi/strapi: “4.23.0”:
- better-sqlite3: “8.6.0”,:
- Node Version: v18.20.3:
- NPM Version: 10.7.0:
src/index.js
"use strict";
module.exports = {
register({ strapi }) {
const extensionService = strapi.plugin("graphql").service("extension");
extensionService.use(({ nexus }) => ({
types: [
nexus.extendType({
type: "UsersPermissionsMe",
definition(t) {
t.string("firstName");
t.string("lastName");
t.field("image", { type: "UploadFileEntityResponse" });
},
}),
],
}));
},
bootstrap({ strapi }) {},
};
//query
query Me {
me {
firstName
lastName
image {
data {
attributes {
url
}
}
}
}
}
//response
{
"data": {
"me": {
"firstName": "john",
"lastName": "doe",
"image": null
}
}
}
// src/extensions/user-permission/content-types/user/schema.json
{
......
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"image": {
"allowedTypes": [
"images"
],
"type": "media",
"multiple": false,
"required": true
}
}
}
String fields are visible, but the image field is not. I don’t understand why this is happening.