chore: Add available app enum type to validate app keys

This commit is contained in:
Faruk AYDIN
2021-11-24 16:48:42 +01:00
committed by Ömer Faruk Aydın
parent 23621d1b06
commit 81d04e417d
2 changed files with 20 additions and 2 deletions

View File

@@ -1,7 +1,8 @@
import { GraphQLString, GraphQLNonNull } from 'graphql';
import { GraphQLString, GraphQLNonNull, GraphQLEnumType } from 'graphql';
import Connection from '../../models/connection';
import App from '../../models/app';
import connectionType from '../types/connection';
import availableAppsEnumType from '../types/available-apps-enum-type';
import RequestWithCurrentUser from '../../types/express/request-with-current-user';
import { GraphQLJSONObject } from 'graphql-type-json';
@@ -27,7 +28,7 @@ const createConnectionResolver = async (params: Params, req: RequestWithCurrentU
const createConnection = {
type: connectionType,
args: {
key: { type: GraphQLNonNull(GraphQLString) },
key: { type: availableAppsEnumType },
data: { type: GraphQLNonNull(GraphQLJSONObject) }
},
resolve: (_: any, params: Params, req: RequestWithCurrentUser) => createConnectionResolver(params, req)