Stripped out the bad code

This commit is contained in:
2020-03-06 16:01:22 +11:00
parent 66d8cd7630
commit fdb88859d1
2 changed files with 17 additions and 75 deletions

View File

@@ -1,35 +1,13 @@
const database = require('./database.js');
console.log(database);
//the handler routines
const handler = {
Book: scalars => {
//takes an array of scalar types as objects: { typeName: 'String', name: 'title' }
//must return an array of objects containing the results
return database.books.map(b => {
const ret = {};
if (scalars.some(s => s.name == 'title')) {
ret.title = b.title;
}
if (scalars.some(s => s.name == 'author')) {
ret.author = b.author;
}
if (scalars.some(s => s.name == 'published')) {
ret.published = b.published;
}
return ret;
});
//TODO
},
Author: scalars => {
//takes an array of scalar types as objects: { typeName: 'String', name: 'name' }
//must return an array of objects containing the results
//TODO
},
create: (sets, matches) => {