Skip to content

Commit

Permalink
fix(createResolversModel.js): update relatedField handling to support…
Browse files Browse the repository at this point in the history
… object type for better flexibility in data loading

chore(package.json): bump version to 0.1.30 for release of new features and fixes
  • Loading branch information
danyel117 committed Sep 12, 2024
1 parent 9b67565 commit 40e013d
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
Binary file modified bun.lockb
100644 → 100755
Binary file not shown.
2 changes: 1 addition & 1 deletion lib/utils/createResolversModel.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ var createResolvers = function (model, parsedModels) { return __awaiter(void 0,
return f.attributes.filter(function (a) { return a.includes(relationName_1); })
.length > 0;
})[0];
return "".concat(rf.name, ": async (parent: ").concat(model.name, ", _: null, { db, session }) => {\n ").concat((0, capitalize_1.unCapitalize)(model.name), "DataLoader.").concat(rf.name, "Loader.clearAll() \n return await ").concat((0, capitalize_1.unCapitalize)(model.name), "DataLoader.").concat(rf.name, "Loader.load(parent.").concat(relatedField, ");\n }");
return "".concat(rf.name, ": async (parent: ").concat(model.name, ", _: null, { db, session }) => {\n ").concat((0, capitalize_1.unCapitalize)(model.name), "DataLoader.").concat(rf.name, "Loader.clearAll() \n return await ").concat((0, capitalize_1.unCapitalize)(model.name), "DataLoader.").concat(rf.name, "Loader.load(parent.").concat(typeof relatedField === 'object' ? 'id' : relatedField, ");\n }");
}
else {
return "".concat(rf.name, ": async (parent: ").concat(model.name, ", _: null, { db,session }) => {\n ").concat((0, capitalize_1.unCapitalize)(model.name), "DataLoader.").concat(rf.name, "Loader.clearAll() \n return await ").concat((0, capitalize_1.unCapitalize)(model.name), "DataLoader.").concat(rf.name, "Loader.load(parent.id);\n }");
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@prevalentware/prisma-cosmo",
"version": "0.1.29",
"version": "0.1.30",
"description": "Prisma GraphQL generator",
"main": "./lib/index.js",
"author": "prevalentWare",
Expand Down

0 comments on commit 40e013d

Please sign in to comment.