Commit 02183f82 authored by NGPixel's avatar NGPixel

feat: mutations + updated deps

parent 840eb7e7
...@@ -37,13 +37,13 @@ ...@@ -37,13 +37,13 @@
"node": ">=6.11.1" "node": ">=6.11.1"
}, },
"dependencies": { "dependencies": {
"apollo-server-express": "1.0.5", "apollo-server-express": "1.1.0",
"auto-load": "3.0.0", "auto-load": "3.0.0",
"axios": "0.16.2", "axios": "0.16.2",
"bcryptjs-then": "1.0.1", "bcryptjs-then": "1.0.1",
"bluebird": "3.5.0", "bluebird": "3.5.0",
"body-parser": "1.17.2", "body-parser": "1.17.2",
"bull": "3.0.0-rc.4", "bull": "3.0.0-rc.7",
"bunyan": "1.8.12", "bunyan": "1.8.12",
"cheerio": "1.0.0-rc.2", "cheerio": "1.0.0-rc.2",
"child-process-promise": "2.2.1", "child-process-promise": "2.2.1",
...@@ -58,23 +58,23 @@ ...@@ -58,23 +58,23 @@
"express-brute": "1.0.1", "express-brute": "1.0.1",
"express-brute-redis": "0.0.1", "express-brute-redis": "0.0.1",
"express-session": "1.15.5", "express-session": "1.15.5",
"file-type": "5.2.0", "file-type": "6.1.0",
"filesize.js": "1.0.2", "filesize.js": "1.0.2",
"follow-redirects": "1.2.4", "follow-redirects": "1.2.4",
"fs-extra": "4.0.1", "fs-extra": "4.0.1",
"git-wrapper2-promise": "0.2.9", "git-wrapper2-promise": "0.2.9",
"graphql": "0.10.5", "graphql": "0.10.5",
"graphql-tools": "1.1.0", "graphql-tools": "1.2.1",
"highlight.js": "9.12.0", "highlight.js": "9.12.0",
"i18next": "8.4.3", "i18next": "8.4.3",
"i18next-express-middleware": "1.0.5", "i18next-express-middleware": "1.0.5",
"i18next-node-fs-backend": "1.0.0", "i18next-node-fs-backend": "1.0.0",
"image-size": "0.6.1", "image-size": "0.6.1",
"ioredis": "3.1.2", "ioredis": "3.1.4",
"jimp": "0.2.28", "jimp": "0.2.28",
"js-yaml": "3.9.1", "js-yaml": "3.9.1",
"jsonwebtoken": "7.4.2", "jsonwebtoken": "7.4.3",
"klaw": "2.0.0", "klaw": "2.1.0",
"levelup": "1.3.9", "levelup": "1.3.9",
"lodash": "4.17.4", "lodash": "4.17.4",
"markdown-it": "8.3.2", "markdown-it": "8.3.2",
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
"markdown-it-footnote": "3.0.1", "markdown-it-footnote": "3.0.1",
"markdown-it-mathjax": "2.0.0", "markdown-it-mathjax": "2.0.0",
"markdown-it-task-lists": "2.0.1", "markdown-it-task-lists": "2.0.1",
"mathjax-node": "1.1.0", "mathjax-node": "1.1.1",
"memdown": "1.2.4", "memdown": "1.2.4",
"mime-types": "2.1.16", "mime-types": "2.1.16",
"moment": "2.18.1", "moment": "2.18.1",
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
"node-2fa": "1.1.2", "node-2fa": "1.1.2",
"node-graceful": "0.2.3", "node-graceful": "0.2.3",
"ora": "1.3.0", "ora": "1.3.0",
"passport": "0.3.2", "passport": "0.4.0",
"passport-azure-ad-oauth2": "0.0.4", "passport-azure-ad-oauth2": "0.0.4",
"passport-facebook": "2.1.1", "passport-facebook": "2.1.1",
"passport-github2": "0.1.10", "passport-github2": "0.1.10",
...@@ -106,24 +106,24 @@ ...@@ -106,24 +106,24 @@
"passport-slack": "0.0.7", "passport-slack": "0.0.7",
"passport-windowslive": "1.0.2", "passport-windowslive": "1.0.2",
"passport.socketio": "3.7.0", "passport.socketio": "3.7.0",
"pg": "7.1.0", "pg": "7.1.2",
"pg-hstore": "2.3.2", "pg-hstore": "2.3.2",
"pg-promise": "6.3.7", "pg-promise": "6.5.0",
"pm2": "2.6.1", "pm2": "2.6.1",
"pug": "2.0.0-rc.3", "pug": "2.0.0-rc.3",
"read-chunk": "2.1.0", "read-chunk": "2.1.0",
"remove-markdown": "0.2.1", "remove-markdown": "0.2.2",
"request": "2.81.0", "request": "2.81.0",
"search-index-adder": "0.3.9", "search-index-adder": "0.3.9",
"search-index-searcher": "0.2.10", "search-index-searcher": "0.2.10",
"semver": "5.4.1", "semver": "5.4.1",
"sequelize": "4.4.2", "sequelize": "4.5.0",
"serve-favicon": "2.4.3", "serve-favicon": "2.4.3",
"simplemde": "1.11.2", "simplemde": "1.11.2",
"socket.io": "2.0.3", "socket.io": "2.0.3",
"stopword": "0.1.6", "stopword": "0.1.6",
"stream-to-promise": "2.2.0", "stream-to-promise": "2.2.0",
"tar": "3.1.9", "tar": "4.0.0",
"through2": "2.0.3", "through2": "2.0.3",
"validator": "8.0.0", "validator": "8.0.0",
"validator-as-promised": "1.0.2", "validator-as-promised": "1.0.2",
...@@ -133,7 +133,7 @@ ...@@ -133,7 +133,7 @@
"devDependencies": { "devDependencies": {
"@glimpse/glimpse": "0.22.15", "@glimpse/glimpse": "0.22.15",
"@panter/vue-i18next": "0.5.1", "@panter/vue-i18next": "0.5.1",
"babel-cli": "6.24.1", "babel-cli": "6.26.0",
"babel-jest": "20.0.3", "babel-jest": "20.0.3",
"babel-plugin-transform-object-assign": "6.22.0", "babel-plugin-transform-object-assign": "6.22.0",
"babel-preset-es2015": "6.24.1", "babel-preset-es2015": "6.24.1",
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
"eslint-plugin-node": "5.1.1", "eslint-plugin-node": "5.1.1",
"eslint-plugin-promise": "3.5.0", "eslint-plugin-promise": "3.5.0",
"eslint-plugin-standard": "3.0.1", "eslint-plugin-standard": "3.0.1",
"fuse-box": "2.2.1", "fuse-box": "2.2.2",
"i18next-xhr-backend": "1.4.2", "i18next-xhr-backend": "1.4.2",
"jest": "20.0.4", "jest": "20.0.4",
"jquery": "3.2.1", "jquery": "3.2.1",
...@@ -162,7 +162,7 @@ ...@@ -162,7 +162,7 @@
"twemoji-awesome": "1.0.6", "twemoji-awesome": "1.0.6",
"typescript": "2.4.2", "typescript": "2.4.2",
"uglify-es": "3.0.27", "uglify-es": "3.0.27",
"vee-validate": "2.0.0-rc.9", "vee-validate": "2.0.0-rc.13",
"vue": "2.4.2", "vue": "2.4.2",
"vue-clipboards": "1.1.0", "vue-clipboards": "1.1.0",
"vue-lodash": "1.0.3", "vue-lodash": "1.0.3",
......
...@@ -10,12 +10,14 @@ const _ = require('lodash') ...@@ -10,12 +10,14 @@ const _ = require('lodash')
const typeDefs = fs.readFileSync(path.join(wiki.SERVERPATH, 'schemas/types.graphql'), 'utf8') const typeDefs = fs.readFileSync(path.join(wiki.SERVERPATH, 'schemas/types.graphql'), 'utf8')
const DateScalar = require('../schemas/scalar-date') const DateScalar = require('../schemas/scalar-date')
const DocumentResolvers = require('../schemas/resolvers-document')
const FolderResolvers = require('../schemas/resolvers-folder') const FolderResolvers = require('../schemas/resolvers-folder')
const GroupResolvers = require('../schemas/resolvers-group') const GroupResolvers = require('../schemas/resolvers-group')
const TagResolvers = require('../schemas/resolvers-tag') const TagResolvers = require('../schemas/resolvers-tag')
const UserResolvers = require('../schemas/resolvers-user') const UserResolvers = require('../schemas/resolvers-user')
const resolvers = _.merge( const resolvers = _.merge(
DocumentResolvers,
FolderResolvers, FolderResolvers,
GroupResolvers, GroupResolvers,
TagResolvers, TagResolvers,
......
'use strict'
/* global wiki */
module.exports = {
Query: {
documents(obj, args, context, info) {
return wiki.db.Document.findAll({ where: args })
}
},
Mutation: {
createDocument(obj, args) {
return wiki.db.Document.create(args)
},
deleteDocument(obj, args) {
return wiki.db.Document.destroy({
where: {
id: args.id
},
limit: 1
})
}
},
Document: {
tags(doc) {
return doc.getTags()
}
}
}
...@@ -108,7 +108,7 @@ type Tag implements Base { ...@@ -108,7 +108,7 @@ type Tag implements Base {
id: Int! id: Int!
createdAt: Date createdAt: Date
updatedAt: Date updatedAt: Date
key: String!, key: String!
documents: [Document] documents: [Document]
} }
...@@ -125,6 +125,11 @@ type User implements Base { ...@@ -125,6 +125,11 @@ type User implements Base {
groups: [Group] groups: [Group]
} }
type OperationResult {
succeded: Boolean!
message: String
}
# Query (Read) # Query (Read)
type Query { type Query {
comments(id: Int): [Comment] comments(id: Int): [Comment]
...@@ -143,45 +148,111 @@ type Mutation { ...@@ -143,45 +148,111 @@ type Mutation {
assignTagToDocument( assignTagToDocument(
tagId: Int! tagId: Int!
documentId: Int! documentId: Int!
): Boolean ): OperationResult
assignUserToGroup( assignUserToGroup(
userId: Int! userId: Int!
groupId: Int! groupId: Int!
): Boolean ): OperationResult
createDocument(
path: String!
title: String!
subtitle: String
): Document
createFolder( createFolder(
name: String! name: String!
): Folder ): Folder
createGroup( createGroup(
name: String! name: String!
): Group ): Group
createTag( createTag(
name: String! name: String!
): Tag ): Tag
createUser( createUser(
email: String! email: String!
name: String name: String
passwordRaw: String
provider: String! provider: String!
providerId: String providerId: String
role: UserRole! role: UserRole!
): User ): User
deleteDocument(
id: Int!
): OperationResult
deleteFolder( deleteFolder(
id: Int! id: Int!
): Boolean ): OperationResult
deleteGroup( deleteGroup(
id: Int! id: Int!
): Boolean ): OperationResult
deleteTag( deleteTag(
id: Int! id: Int!
): Boolean ): OperationResult
deleteUser( deleteUser(
id: Int! id: Int!
): Boolean ): OperationResult
modifyDocument(
id: Int!
title: String
subtitle: String
): Document
modifyUser(
id: Int!
email: String
name: String
provider: String
providerId: String
role: UserRole
): User
moveDocument(
id: Int!
path: String!
): OperationResult
renameFolder(
id: Int!
name: String!
): OperationResult
renameGroup(
id: Int!
name: String!
): OperationResult
renameTag(
id: Int!
name: String!
): OperationResult
removeTagFromDocument( removeTagFromDocument(
tagId: Int! tagId: Int!
documentId: Int! documentId: Int!
): Boolean ): OperationResult
removeUserFromGroup( removeUserFromGroup(
userId: Int! userId: Int!
groupId: Int! groupId: Int!
): Boolean ): OperationResult
resetUserPassword(
id: Int!
): OperationResult
setUserPassword(
id: Int!
passwordRaw: String!
): OperationResult
} }
This diff was suppressed by a .gitattributes entry.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment