GraphQL show custom fields from table in many to many relationGraphQL custom scalar definition without `graphql-tools`GraphQL not calling custom scalar methodsgraphql: adding a field to a join tableQuerying many to many relation graphqlUnknown argument “record” on field of type “Mutation” (graphql-compose)Building GraphQL Resolver to Return List of Strings — Receiving [object Object] Instead of StringsApollo GraphQL fails to invoke resolver for a nested fieldUsing GraphQL with conditional related typesHow to implement interface using GraphQL and nodeResolver in graphql on relation
Why is drive/partition number still used?
Why was Sauron preparing for war instead of trying to find the ring?
How to apply the changes to my `.zshrc` file after edit?
Symplectisation as a functor between appropriate categories
What does "see" in "the Holy See" mean?
To find islands of 1 and 0 in matrix
The best place for swimming in Arctic Ocean
Sci fi story: Clever pigs that help a galaxy lawman
When does Haskell complain about incorrect typing in functions?
Why do planes need a roll motion?
If a 2019 UA artificer has the Repeating Shot infusion on two hand crossbows, can they use two-weapon fighting?
What do I do with a party that is much stronger than their level?
What do you call a flexible diving platform?
Why does Canada require mandatory bilingualism in all government posts?
How did the Axis intend to hold the Caucasus?
Pointwise convergence of uniformly continuous functions to zero, but not uniformly
How did the SysRq key get onto modern keyboards if it's rarely used?
Are the named pipe created by `mknod` and the FIFO created by `mkfifo` equivalent?
Old French song lyrics with the word "baiser."
How to check what is edible on an alien world?
Examples of simultaneous independent breakthroughs
Is this photo showing a woman standing in the nude before teenagers real?
Japanese reading of an integer
Does the Intel 8086 CPU have user mode and kernel mode?
GraphQL show custom fields from table in many to many relation
GraphQL custom scalar definition without `graphql-tools`GraphQL not calling custom scalar methodsgraphql: adding a field to a join tableQuerying many to many relation graphqlUnknown argument “record” on field of type “Mutation” (graphql-compose)Building GraphQL Resolver to Return List of Strings — Receiving [object Object] Instead of StringsApollo GraphQL fails to invoke resolver for a nested fieldUsing GraphQL with conditional related typesHow to implement interface using GraphQL and nodeResolver in graphql on relation
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to show my custom field "position" from many to many relation.
Bucket
id | fk_language_id | code
Block
id | code
Bucket_Block
id | fk_bucket_id | fk_block_id | position
schema.js
# Bucket
type Bucket
id: Int!,
code: String
language(id: Int): Language
blocks: [Block]
# Block
type Block
id: Int!,
code: String,
is_active: Boolean,
position: Int
# query for types
type Query
buckets: [Bucket]
resolvers.js
Bucket:
blocks(bucket)
return bucket.getBlocks();
,
connectors.js
// define bucket
const BucketModel = db.define('bucket',
code : type: Sequelize.STRING,
is_active: type: Sequelize.BOOLEAN
);
// define block
const BlockModel = db.define('block',
code : type: Sequelize.STRING,
is_active: type: Sequelize.BOOLEAN
);
// define bucket_block
const BucketBlockModel = db.define('bucket_block',
position: type: Sequelize.INTEGER
);
BucketModel.belongsToMany(BlockModel,
through : 'bucket_block',
foreignKey: 'fk_bucket_id'
);
BlockModel.belongsToMany(BucketModel,
through : 'bucket_block',
foreignKey: 'fk_block_id'
);
I tried to add pivot: Int in my schema but the field doesn't
"position": null
graphql sequelize.js apollo-server
add a comment |
I would like to show my custom field "position" from many to many relation.
Bucket
id | fk_language_id | code
Block
id | code
Bucket_Block
id | fk_bucket_id | fk_block_id | position
schema.js
# Bucket
type Bucket
id: Int!,
code: String
language(id: Int): Language
blocks: [Block]
# Block
type Block
id: Int!,
code: String,
is_active: Boolean,
position: Int
# query for types
type Query
buckets: [Bucket]
resolvers.js
Bucket:
blocks(bucket)
return bucket.getBlocks();
,
connectors.js
// define bucket
const BucketModel = db.define('bucket',
code : type: Sequelize.STRING,
is_active: type: Sequelize.BOOLEAN
);
// define block
const BlockModel = db.define('block',
code : type: Sequelize.STRING,
is_active: type: Sequelize.BOOLEAN
);
// define bucket_block
const BucketBlockModel = db.define('bucket_block',
position: type: Sequelize.INTEGER
);
BucketModel.belongsToMany(BlockModel,
through : 'bucket_block',
foreignKey: 'fk_bucket_id'
);
BlockModel.belongsToMany(BucketModel,
through : 'bucket_block',
foreignKey: 'fk_block_id'
);
I tried to add pivot: Int in my schema but the field doesn't
"position": null
graphql sequelize.js apollo-server
add a comment |
I would like to show my custom field "position" from many to many relation.
Bucket
id | fk_language_id | code
Block
id | code
Bucket_Block
id | fk_bucket_id | fk_block_id | position
schema.js
# Bucket
type Bucket
id: Int!,
code: String
language(id: Int): Language
blocks: [Block]
# Block
type Block
id: Int!,
code: String,
is_active: Boolean,
position: Int
# query for types
type Query
buckets: [Bucket]
resolvers.js
Bucket:
blocks(bucket)
return bucket.getBlocks();
,
connectors.js
// define bucket
const BucketModel = db.define('bucket',
code : type: Sequelize.STRING,
is_active: type: Sequelize.BOOLEAN
);
// define block
const BlockModel = db.define('block',
code : type: Sequelize.STRING,
is_active: type: Sequelize.BOOLEAN
);
// define bucket_block
const BucketBlockModel = db.define('bucket_block',
position: type: Sequelize.INTEGER
);
BucketModel.belongsToMany(BlockModel,
through : 'bucket_block',
foreignKey: 'fk_bucket_id'
);
BlockModel.belongsToMany(BucketModel,
through : 'bucket_block',
foreignKey: 'fk_block_id'
);
I tried to add pivot: Int in my schema but the field doesn't
"position": null
graphql sequelize.js apollo-server
I would like to show my custom field "position" from many to many relation.
Bucket
id | fk_language_id | code
Block
id | code
Bucket_Block
id | fk_bucket_id | fk_block_id | position
schema.js
# Bucket
type Bucket
id: Int!,
code: String
language(id: Int): Language
blocks: [Block]
# Block
type Block
id: Int!,
code: String,
is_active: Boolean,
position: Int
# query for types
type Query
buckets: [Bucket]
resolvers.js
Bucket:
blocks(bucket)
return bucket.getBlocks();
,
connectors.js
// define bucket
const BucketModel = db.define('bucket',
code : type: Sequelize.STRING,
is_active: type: Sequelize.BOOLEAN
);
// define block
const BlockModel = db.define('block',
code : type: Sequelize.STRING,
is_active: type: Sequelize.BOOLEAN
);
// define bucket_block
const BucketBlockModel = db.define('bucket_block',
position: type: Sequelize.INTEGER
);
BucketModel.belongsToMany(BlockModel,
through : 'bucket_block',
foreignKey: 'fk_bucket_id'
);
BlockModel.belongsToMany(BucketModel,
through : 'bucket_block',
foreignKey: 'fk_block_id'
);
I tried to add pivot: Int in my schema but the field doesn't
"position": null
graphql sequelize.js apollo-server
graphql sequelize.js apollo-server
asked Mar 26 at 18:40
Jérémie ChazelleJérémie Chazelle
1,02417 silver badges42 bronze badges
1,02417 silver badges42 bronze badges
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55364175%2fgraphql-show-custom-fields-from-table-in-many-to-many-relation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55364175%2fgraphql-show-custom-fields-from-table-in-many-to-many-relation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown