feat: admin general + verify account
This commit is contained in:
@@ -61,13 +61,7 @@ module.exports = {
|
||||
async register(obj, args, context) {
|
||||
try {
|
||||
await WIKI.models.users.register(args, context)
|
||||
const authResult = await WIKI.models.users.login({
|
||||
username: args.email,
|
||||
password: args.password,
|
||||
strategy: 'local'
|
||||
}, context)
|
||||
return {
|
||||
jwt: authResult.jwt,
|
||||
responseResult: graphHelper.generateSuccess('Registration success')
|
||||
}
|
||||
} catch (err) {
|
||||
|
56
server/graph/resolvers/site.js
Normal file
56
server/graph/resolvers/site.js
Normal file
@@ -0,0 +1,56 @@
|
||||
const _ = require('lodash')
|
||||
const graphHelper = require('../../helpers/graph')
|
||||
|
||||
/* global WIKI */
|
||||
|
||||
module.exports = {
|
||||
Query: {
|
||||
async site() { return {} }
|
||||
},
|
||||
Mutation: {
|
||||
async site() { return {} }
|
||||
},
|
||||
SiteQuery: {
|
||||
async config(obj, args, context, info) {
|
||||
return {
|
||||
host: WIKI.config.host,
|
||||
title: WIKI.config.title,
|
||||
company: WIKI.config.company,
|
||||
...WIKI.config.seo,
|
||||
...WIKI.config.logo,
|
||||
...WIKI.config.features
|
||||
}
|
||||
}
|
||||
},
|
||||
SiteMutation: {
|
||||
async updateConfig(obj, args, context) {
|
||||
try {
|
||||
WIKI.config.host = args.host
|
||||
WIKI.config.title = args.title
|
||||
WIKI.config.company = args.company
|
||||
WIKI.config.seo = {
|
||||
description: args.description,
|
||||
keywords: args.keywords,
|
||||
robots: args.robots,
|
||||
ga: args.ga
|
||||
}
|
||||
WIKI.config.logo = {
|
||||
hasLogo: args.hasLogo,
|
||||
logoIsSquare: args.logoIsSquare
|
||||
}
|
||||
WIKI.config.features = {
|
||||
featurePageRatings: args.featurePageRatings,
|
||||
featurePageComments: args.featurePageComments,
|
||||
featurePersonalWikis: args.featurePersonalWikis
|
||||
}
|
||||
await WIKI.configSvc.saveToDb(['host', 'title', 'company', 'seo', 'logo', 'features'])
|
||||
|
||||
return {
|
||||
responseResult: graphHelper.generateSuccess('Site configuration updated successfully')
|
||||
}
|
||||
} catch (err) {
|
||||
return graphHelper.generateError(err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user