Skip to content
Snippets Groups Projects
Commit 0b21b6f9 authored by Quentin CHEVALIER's avatar Quentin CHEVALIER
Browse files

Merge branch 'master' of gitlab.binets.fr:br/sigma-backend

parents eb3d73a1 4dabba64
No related branches found
No related tags found
No related merge requests found
db/migrations/
db/seeds/ db/seeds/
build/ build/
node_modules/ node_modules/
......
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');
});
};
...@@ -25,12 +25,14 @@ const typeDefs = ` ...@@ -25,12 +25,14 @@ const typeDefs = `
`; `;
const getAllVisibleGroups = (user) => { const getAllVisibleGroups = (user) => {
console.log("getAllVisibleGroups gets called")
// let group_ids = listGroups(user.id); // let group_ids = listGroups(user.id);
return knex.select().from('groups')/*.whereIn('id', group_ids)*/; return knex.select().from('groups')/*.whereIn('id', group_ids)*/;
}; };
const getGroupIfVisible = (user, id) => { 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))*/; console.log(JSON.stringify(table,null,2))*/;
}; };
...@@ -40,7 +42,6 @@ const resolvers = { ...@@ -40,7 +42,6 @@ const resolvers = {
return getAllVisibleGroups(context.user); return getAllVisibleGroups(context.user);
}, },
group: (obj, args, context) => { group: (obj, args, context) => {
console.log(args.id);
return getGroupIfVisible(context.user, args.id); return getGroupIfVisible(context.user, args.id);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment