Skip to content
Snippets Groups Projects
Commit d6648bad authored by Anatole ROMON's avatar Anatole ROMON
Browse files

amelioration

parent 98df6b1e
No related branches found
No related tags found
No related merge requests found
......@@ -11,7 +11,7 @@ import { request } from 'https';
const typeDefs = `
type Query {
allGroups: [Group]
group(id: ID) : [Group]
group(id: ID) : Group
}
type Group {
......@@ -25,17 +25,14 @@ const typeDefs = `
`;
const getAllVisibleGroups = (user) => {
var group_ids;
console.log(user.id);
listGroups(user.id).then(res => {
group_ids = res;
});
return knex.select().from('groups').whereIn('id', group_ids);
var group_ids = listGroups(user.id).then(res => res);
return knex.select().from('groups').whereIn('id', [1, 2, 3]/*group_ids*/);
};
const getGroupIfVisible = (user, id) => {
return getAllVisibleGroups(user).where('id', id)/*.then(function(table) {
console.log(JSON.stringify(table,null,2))*/;
return getAllVisibleGroups(user).where('id', id).then(res => {
return res[0];
});
};
const resolvers = {
......
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