Skip to content

Commit

Permalink
Merge pull request #9 from prevalentWare/fix-relaciones
Browse files Browse the repository at this point in the history
fix(createResolversModel.ts): fix dynamic field loading logic to hand…
  • Loading branch information
danyel117 authored Sep 12, 2024
2 parents a06829f + eaea2c2 commit 9b67565
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils/createResolversModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const createResolvers = async (model: GQLModel, parsedModels: GQLModel[]) => {
return `${rf.name}: async (parent: ${model.name}, _: null, { db, session }) => {
${unCapitalize(model.name)}DataLoader.${rf.name}Loader.clearAll()
return await ${unCapitalize(model.name)}DataLoader.${rf.name}Loader.load(parent.${relatedField});
return await ${unCapitalize(model.name)}DataLoader.${rf.name}Loader.load(parent.${typeof relatedField=== 'object'?'id':relatedField});
}`;
} else {
return `${rf.name}: async (parent: ${model.name}, _: null, { db,session }) => {
Expand Down

0 comments on commit 9b67565

Please sign in to comment.