Files
vue-cli/packages/@vue/cli-ui/apollo-server/schema/git.js
2018-06-30 14:17:48 +02:00

57 lines
845 B
JavaScript

const gql = require('graphql-tag')
// Connectors
const git = require('../connectors/git')
exports.types = gql`
extend type Query {
fileDiffs: [FileDiff]
}
extend type Mutation {
gitCommit (message: String!): Boolean
}
type FileDiff {
id: ID!
from: String
to: String
new: Boolean
deleted: Boolean
binary: Boolean
chunks: [FileDiffChunk]
}
type FileDiffChunk {
changes: [FileDiffChange]
oldStart: Int
oldLines: Int
newStart: Int
newLines: Int
}
type FileDiffChange {
type: FileDiffChangeType
ln: Int
ln1: Int
ln2: Int
content: String
normal: Boolean
}
enum FileDiffChangeType {
normal
add
del
}
`
exports.resolvers = {
Query: {
fileDiffs: (root, args, context) => git.getDiffs(context)
},
Mutation: {
gitCommit: (root, { message }, context) => git.commit(message, context)
}
}