diff --git a/.eslintignore b/.eslintignore index f676072424679bb80c35a57410f06b66ee17640b..a98e484f1b27a835657694011038e61158079ffb 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,3 @@ -db/migrations/ db/seeds/ build/ node_modules/ diff --git a/db/migrations/20180301104213_insert_parent_column.js b/db/migrations/20180301104213_insert_parent_column.js new file mode 100644 index 0000000000000000000000000000000000000000..871921e71a7421e56cb2ca1f3c22666c6132338f --- /dev/null +++ b/db/migrations/20180301104213_insert_parent_column.js @@ -0,0 +1,12 @@ + +exports.up = function(knex, Promise) { + return knex.schema.table('groups', function(t) { + t.integer('parent'); + }); +}; + +exports.down = function(knex, Promise) { + return knex.schema.table('groups', function(t) { + t.dropColumn('parent'); + }); +}; diff --git a/src/graphql/schema.js b/src/graphql/schema.js index c1209010e603e1207bab5e0796236f53137c09b6..9db49a7f6ee041cba7828726ed30a83a69728660 100644 --- a/src/graphql/schema.js +++ b/src/graphql/schema.js @@ -25,12 +25,14 @@ const typeDefs = ` `; const getAllVisibleGroups = (user) => { + console.log("getAllVisibleGroups gets called") // let group_ids = listGroups(user.id); return knex.select().from('groups')/*.whereIn('id', group_ids)*/; }; const getGroupIfVisible = (user, id) => { - return getAllVisibleGroups(user)/*.where('id', id).then(function(table) { + console.log("getGroupIfVisible gets called") + return getAllVisibleGroups(user).where('id', id)/*.then(function(table) { console.log(JSON.stringify(table,null,2))*/; }; @@ -40,7 +42,6 @@ const resolvers = { return getAllVisibleGroups(context.user); }, group: (obj, args, context) => { - console.log(args.id); return getGroupIfVisible(context.user, args.id); } }