2017-07-25 02:37:13 +00:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
/* global wiki */
|
|
|
|
|
2017-08-07 01:05:10 +00:00
|
|
|
const gqlTools = require('graphql-tools')
|
|
|
|
const fs = require('fs')
|
|
|
|
const path = require('path')
|
2017-07-25 02:37:13 +00:00
|
|
|
|
2017-08-07 01:05:10 +00:00
|
|
|
const typeDefs = fs.readFileSync(path.join(wiki.SERVERPATH, 'schemas/types.graphql'), 'utf8')
|
2017-07-25 02:37:13 +00:00
|
|
|
|
2017-08-07 01:05:10 +00:00
|
|
|
const GroupResolvers = require('../schemas/resolvers-group')
|
|
|
|
const UserResolvers = require('../schemas/resolvers-user')
|
|
|
|
|
|
|
|
const resolvers = {
|
|
|
|
Query: {
|
|
|
|
groups: GroupResolvers.Query,
|
|
|
|
users: UserResolvers.Query
|
|
|
|
},
|
|
|
|
Group: GroupResolvers.Type,
|
|
|
|
User: UserResolvers.Type
|
|
|
|
}
|
2017-07-25 02:37:13 +00:00
|
|
|
|
2017-08-07 01:05:10 +00:00
|
|
|
const Schema = gqlTools.makeExecutableSchema({
|
|
|
|
typeDefs,
|
|
|
|
resolvers
|
2017-07-25 02:37:13 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
module.exports = Schema
|