2
0
Эх сурвалжийг харах

feat: mutations + updated deps

NGPixel 7 жил өмнө
parent
commit
02183f82ec

+ 17 - 17
package.json

@@ -37,13 +37,13 @@
     "node": ">=6.11.1"
   },
   "dependencies": {
-    "apollo-server-express": "1.0.5",
+    "apollo-server-express": "1.1.0",
     "auto-load": "3.0.0",
     "axios": "0.16.2",
     "bcryptjs-then": "1.0.1",
     "bluebird": "3.5.0",
     "body-parser": "1.17.2",
-    "bull": "3.0.0-rc.4",
+    "bull": "3.0.0-rc.7",
     "bunyan": "1.8.12",
     "cheerio": "1.0.0-rc.2",
     "child-process-promise": "2.2.1",
@@ -58,23 +58,23 @@
     "express-brute": "1.0.1",
     "express-brute-redis": "0.0.1",
     "express-session": "1.15.5",
-    "file-type": "5.2.0",
+    "file-type": "6.1.0",
     "filesize.js": "1.0.2",
     "follow-redirects": "1.2.4",
     "fs-extra": "4.0.1",
     "git-wrapper2-promise": "0.2.9",
     "graphql": "0.10.5",
-    "graphql-tools": "1.1.0",
+    "graphql-tools": "1.2.1",
     "highlight.js": "9.12.0",
     "i18next": "8.4.3",
     "i18next-express-middleware": "1.0.5",
     "i18next-node-fs-backend": "1.0.0",
     "image-size": "0.6.1",
-    "ioredis": "3.1.2",
+    "ioredis": "3.1.4",
     "jimp": "0.2.28",
     "js-yaml": "3.9.1",
-    "jsonwebtoken": "7.4.2",
-    "klaw": "2.0.0",
+    "jsonwebtoken": "7.4.3",
+    "klaw": "2.1.0",
     "levelup": "1.3.9",
     "lodash": "4.17.4",
     "markdown-it": "8.3.2",
@@ -87,7 +87,7 @@
     "markdown-it-footnote": "3.0.1",
     "markdown-it-mathjax": "2.0.0",
     "markdown-it-task-lists": "2.0.1",
-    "mathjax-node": "1.1.0",
+    "mathjax-node": "1.1.1",
     "memdown": "1.2.4",
     "mime-types": "2.1.16",
     "moment": "2.18.1",
@@ -96,7 +96,7 @@
     "node-2fa": "1.1.2",
     "node-graceful": "0.2.3",
     "ora": "1.3.0",
-    "passport": "0.3.2",
+    "passport": "0.4.0",
     "passport-azure-ad-oauth2": "0.0.4",
     "passport-facebook": "2.1.1",
     "passport-github2": "0.1.10",
@@ -106,24 +106,24 @@
     "passport-slack": "0.0.7",
     "passport-windowslive": "1.0.2",
     "passport.socketio": "3.7.0",
-    "pg": "7.1.0",
+    "pg": "7.1.2",
     "pg-hstore": "2.3.2",
-    "pg-promise": "6.3.7",
+    "pg-promise": "6.5.0",
     "pm2": "2.6.1",
     "pug": "2.0.0-rc.3",
     "read-chunk": "2.1.0",
-    "remove-markdown": "0.2.1",
+    "remove-markdown": "0.2.2",
     "request": "2.81.0",
     "search-index-adder": "0.3.9",
     "search-index-searcher": "0.2.10",
     "semver": "5.4.1",
-    "sequelize": "4.4.2",
+    "sequelize": "4.5.0",
     "serve-favicon": "2.4.3",
     "simplemde": "1.11.2",
     "socket.io": "2.0.3",
     "stopword": "0.1.6",
     "stream-to-promise": "2.2.0",
-    "tar": "3.1.9",
+    "tar": "4.0.0",
     "through2": "2.0.3",
     "validator": "8.0.0",
     "validator-as-promised": "1.0.2",
@@ -133,7 +133,7 @@
   "devDependencies": {
     "@glimpse/glimpse": "0.22.15",
     "@panter/vue-i18next": "0.5.1",
-    "babel-cli": "6.24.1",
+    "babel-cli": "6.26.0",
     "babel-jest": "20.0.3",
     "babel-plugin-transform-object-assign": "6.22.0",
     "babel-preset-es2015": "6.24.1",
@@ -146,7 +146,7 @@
     "eslint-plugin-node": "5.1.1",
     "eslint-plugin-promise": "3.5.0",
     "eslint-plugin-standard": "3.0.1",
-    "fuse-box": "2.2.1",
+    "fuse-box": "2.2.2",
     "i18next-xhr-backend": "1.4.2",
     "jest": "20.0.4",
     "jquery": "3.2.1",
@@ -162,7 +162,7 @@
     "twemoji-awesome": "1.0.6",
     "typescript": "2.4.2",
     "uglify-es": "3.0.27",
-    "vee-validate": "2.0.0-rc.9",
+    "vee-validate": "2.0.0-rc.13",
     "vue": "2.4.2",
     "vue-clipboards": "1.1.0",
     "vue-lodash": "1.0.3",

+ 2 - 0
server/modules/graphql.js

@@ -10,12 +10,14 @@ const _ = require('lodash')
 const typeDefs = fs.readFileSync(path.join(wiki.SERVERPATH, 'schemas/types.graphql'), 'utf8')
 
 const DateScalar = require('../schemas/scalar-date')
+const DocumentResolvers = require('../schemas/resolvers-document')
 const FolderResolvers = require('../schemas/resolvers-folder')
 const GroupResolvers = require('../schemas/resolvers-group')
 const TagResolvers = require('../schemas/resolvers-tag')
 const UserResolvers = require('../schemas/resolvers-user')
 
 const resolvers = _.merge(
+  DocumentResolvers,
   FolderResolvers,
   GroupResolvers,
   TagResolvers,

+ 29 - 0
server/schemas/resolvers-document.js

@@ -0,0 +1,29 @@
+'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()
+    }
+  }
+}

+ 80 - 9
server/schemas/types.graphql

@@ -108,7 +108,7 @@ type Tag implements Base {
   id: Int!
   createdAt: Date
   updatedAt: Date
-  key: String!,
+  key: String!
   documents: [Document]
 }
 
@@ -125,6 +125,11 @@ type User implements Base {
   groups: [Group]
 }
 
+type OperationResult {
+  succeded: Boolean!
+  message: String
+}
+
 # Query (Read)
 type Query {
   comments(id: Int): [Comment]
@@ -143,45 +148,111 @@ type Mutation {
   assignTagToDocument(
     tagId: Int!
     documentId: Int!
-  ): Boolean
+  ): OperationResult
+
   assignUserToGroup(
     userId: Int!
     groupId: Int!
-  ): Boolean
+  ): OperationResult
+
+  createDocument(
+    path: String!
+    title: String!
+    subtitle: String
+  ): Document
+
   createFolder(
     name: String!
   ): Folder
+
   createGroup(
     name: String!
   ): Group
+
   createTag(
     name: String!
   ): Tag
+
   createUser(
     email: String!
     name: String
+    passwordRaw: String
     provider: String!
     providerId: String
     role: UserRole!
   ): User
+
+  deleteDocument(
+    id: Int!
+  ): OperationResult
+
   deleteFolder(
     id: Int!
-  ): Boolean
+  ): OperationResult
+
   deleteGroup(
     id: Int!
-  ): Boolean
+  ): OperationResult
+
   deleteTag(
     id: Int!
-  ): Boolean
+  ): OperationResult
+
   deleteUser(
     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(
     tagId: Int!
     documentId: Int!
-  ): Boolean
+  ): OperationResult
+
   removeUserFromGroup(
     userId: Int!
     groupId: Int!
-  ): Boolean
+  ): OperationResult
+
+  resetUserPassword(
+    id: Int!
+  ): OperationResult
+
+  setUserPassword(
+    id: Int!
+    passwordRaw: String!
+  ): OperationResult
 }

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 319 - 159
yarn.lock


Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно