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

corrections et finalisation de la modif initiale

parent 51481d2c
No related branches found
No related tags found
No related merge requests found
......@@ -10,7 +10,7 @@ import { request } from 'https';
const typeDefs = `
type Query {
groups: [Group]!
all_groups: [Group]!
group(id : ID) : Group!
}
......@@ -32,13 +32,13 @@ const knex_req = {
},
getGroupIfVisible : (user, id) => {
return getAllVisibleGroups(user).where('id', args.id);
return this.getAllVisibleGroups(user).where('id', id);
}
};
const resolvers = {
Query: {
groups: (obj, args, context) => {
all_groups: (obj, args, context) => {
return knex_req.getAllVisibleGroups(context.user);
},
group: (obj, args, context) => {
......
......@@ -34,7 +34,15 @@ server.use(morgan('dev'));
server.use('/graphql', bodyParser.json(), graphqlExpress({schema}));
// GraphiQL est une console interactive pour faire des requêtes au schéma GraphQL
server.use('/graphiql', graphiqlExpress({ endpointURL: '/graphql'}));
server.use(
'/graphiql',
graphiqlExpress(req => {
return {
schema : schema,
context : {user : {id : req.session.id}},
endpointURL: '/graphql'
}
},));
// connect-flash is middleware for flashing messages
server.use(flash());
......
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