chore: Introduce GraphQLJSONObject type for credentials
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
"express": "~4.16.1",
|
||||
"express-graphql": "^0.12.0",
|
||||
"flickr-sdk": "^3.10.0",
|
||||
"graphql-type-json": "^0.3.2",
|
||||
"http-errors": "~1.6.3",
|
||||
"knex": "^0.95.11",
|
||||
"morgan": "^1.10.0",
|
||||
|
@@ -2,8 +2,8 @@ import { GraphQLString, GraphQLNonNull } from 'graphql';
|
||||
import Connection from '../../models/connection';
|
||||
import App from '../../models/app';
|
||||
import connectionType from '../types/connection';
|
||||
import twitterCredentialInputType from '../types/twitter-credential-input';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
import { GraphQLJSONObject } from 'graphql-type-json';
|
||||
|
||||
type Params = {
|
||||
key: string,
|
||||
@@ -27,7 +27,7 @@ const createConnection = {
|
||||
type: connectionType,
|
||||
args: {
|
||||
key: { type: GraphQLNonNull(GraphQLString) },
|
||||
data: { type: GraphQLNonNull(twitterCredentialInputType) }
|
||||
data: { type: GraphQLNonNull(GraphQLJSONObject) }
|
||||
},
|
||||
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => createConnectionResolver(params, req)
|
||||
};
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { GraphQLString, GraphQLNonNull } from 'graphql';
|
||||
import { GraphQLJSONObject } from 'graphql-type-json';
|
||||
import Connection from '../../models/connection';
|
||||
import connectionType from '../types/connection';
|
||||
import twitterCredentialInputType from '../types/twitter-credential-input';
|
||||
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
|
||||
|
||||
type Params = {
|
||||
@@ -28,7 +28,7 @@ const updateConnection = {
|
||||
type: connectionType,
|
||||
args: {
|
||||
id: { type: GraphQLNonNull(GraphQLString) },
|
||||
data: { type: GraphQLNonNull(twitterCredentialInputType) }
|
||||
data: { type: GraphQLNonNull(GraphQLJSONObject) }
|
||||
},
|
||||
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => updateConnectionResolver(params, req)
|
||||
};
|
||||
|
@@ -1,12 +0,0 @@
|
||||
import { GraphQLString, GraphQLInputObjectType } from 'graphql';
|
||||
|
||||
const twitterCredentialInputType = new GraphQLInputObjectType({
|
||||
name: 'TwitterCredentialInput',
|
||||
fields: {
|
||||
consumerKey: { type: GraphQLString },
|
||||
consumerSecret: { type: GraphQLString },
|
||||
oauthVerifier: { type: GraphQLString },
|
||||
}
|
||||
})
|
||||
|
||||
export default twitterCredentialInputType;
|
@@ -1,11 +0,0 @@
|
||||
import { GraphQLString, GraphQLObjectType } from 'graphql';
|
||||
|
||||
const twitterCredentialInputType = new GraphQLObjectType({
|
||||
name: 'TwitterCredential',
|
||||
fields: {
|
||||
consumerKey: { type: GraphQLString },
|
||||
consumerSecret: { type: GraphQLString },
|
||||
}
|
||||
})
|
||||
|
||||
export default twitterCredentialInputType;
|
@@ -1,7 +1,7 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const CREATE_CONNECTION = gql`
|
||||
mutation CreateConnection($key: String!, $data: TwitterCredentialInput!) {
|
||||
mutation CreateConnection($key: String!, $data: JSONObject!) {
|
||||
createConnection(key: $key, data: $data) {
|
||||
id
|
||||
key
|
||||
|
@@ -1,7 +1,7 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const UPDATE_CONNECTION = gql`
|
||||
mutation UpdateConnection($id: String!, $data: TwitterCredentialInput!) {
|
||||
mutation UpdateConnection($id: String!, $data: JSONObject!) {
|
||||
updateConnection(id: $id, data: $data) {
|
||||
id
|
||||
key
|
||||
|
@@ -7959,6 +7959,11 @@ graphql-tag@^2.12.3:
|
||||
dependencies:
|
||||
tslib "^2.1.0"
|
||||
|
||||
graphql-type-json@^0.3.2:
|
||||
version "0.3.2"
|
||||
resolved "https://registry.yarnpkg.com/graphql-type-json/-/graphql-type-json-0.3.2.tgz#f53a851dbfe07bd1c8157d24150064baab41e115"
|
||||
integrity sha512-J+vjof74oMlCWXSvt0DOf2APEdZOCdubEvGDUAlqH//VBYcOYsGgRW7Xzorr44LvkjiuvecWc8fChxuZZbChtg==
|
||||
|
||||
graphql@^15.6.0:
|
||||
version "15.6.1"
|
||||
resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.6.1.tgz#9125bdf057553525da251e19e96dab3d3855ddfc"
|
||||
|
Reference in New Issue
Block a user