wikijs-fork/server/modules/graphql.js

34 lines
847 B
JavaScript
Raw Normal View History

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')
const _ = require('lodash')
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-13 18:39:07 +00:00
const DateScalar = require('../schemas/scalar-date')
2017-08-19 01:21:29 +00:00
const DocumentResolvers = require('../schemas/resolvers-document')
const FolderResolvers = require('../schemas/resolvers-folder')
2017-08-07 01:05:10 +00:00
const GroupResolvers = require('../schemas/resolvers-group')
const TagResolvers = require('../schemas/resolvers-tag')
2017-08-07 01:05:10 +00:00
const UserResolvers = require('../schemas/resolvers-user')
const resolvers = _.merge(
2017-08-19 01:21:29 +00:00
DocumentResolvers,
FolderResolvers,
GroupResolvers,
TagResolvers,
2017-08-13 18:39:07 +00:00
UserResolvers,
DateScalar
)
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