wikijs-fork/server/modules/graphql.js

44 lines
1.3 KiB
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')
const AuthenticationResolvers = require('../schemas/resolvers-authentication')
const CommentResolvers = require('../schemas/resolvers-comment')
2017-08-19 01:21:29 +00:00
const DocumentResolvers = require('../schemas/resolvers-document')
const FileResolvers = require('../schemas/resolvers-file')
const FolderResolvers = require('../schemas/resolvers-folder')
2017-08-07 01:05:10 +00:00
const GroupResolvers = require('../schemas/resolvers-group')
const SettingResolvers = require('../schemas/resolvers-setting')
const TagResolvers = require('../schemas/resolvers-tag')
const TranslationResolvers = require('../schemas/resolvers-translation')
2017-08-07 01:05:10 +00:00
const UserResolvers = require('../schemas/resolvers-user')
const resolvers = _.merge(
AuthenticationResolvers,
CommentResolvers,
2017-08-19 01:21:29 +00:00
DocumentResolvers,
FileResolvers,
FolderResolvers,
GroupResolvers,
SettingResolvers,
TagResolvers,
TranslationResolvers,
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