|
|
|
@ -156,10 +156,15 @@ module.exports = {
|
|
|
|
|
types: {
|
|
|
|
|
[typeName]: async function({ id }) {
|
|
|
|
|
let normalFields = fieldNames.map((name) => {
|
|
|
|
|
return [ name, async (_, { dlayerKnexTable }) => {
|
|
|
|
|
let record = await dlayerKnexTable.load(id);
|
|
|
|
|
return record[name];
|
|
|
|
|
}];
|
|
|
|
|
if (name === primaryKey) {
|
|
|
|
|
// No point making a trip to the database if all we need is an ID we already have
|
|
|
|
|
return [ name, id ];
|
|
|
|
|
} else {
|
|
|
|
|
return [ name, async (_, { dlayerKnexTable }) => {
|
|
|
|
|
let record = await dlayerKnexTable.load(id);
|
|
|
|
|
return record[name];
|
|
|
|
|
}];
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let relationFields = [];
|
|
|
|
|