chore: Introduce GraphQLJSONObject type for credentials

This commit is contained in:
Faruk AYDIN
2021-10-24 16:51:29 +02:00
committed by Ali BARIN
parent c7d757a337
commit 2eeeeb0028
8 changed files with 12 additions and 29 deletions

View File

@@ -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",

View File

@@ -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)
};

View File

@@ -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)
};

View File

@@ -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;

View File

@@ -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;