chore: Refactor graphQL queries structure
This commit is contained in:
@@ -1,7 +1,21 @@
|
||||
import { GraphQLString, GraphQLList } from 'graphql';
|
||||
import appType from '../types/app';
|
||||
import App from '../../models/app';
|
||||
|
||||
const getApps = (name: string) => {
|
||||
return App.findAll(name)
|
||||
type Params = {
|
||||
name: string
|
||||
}
|
||||
|
||||
const getAppsResolver = (params: Params) => {
|
||||
return App.findAll(params.name)
|
||||
}
|
||||
|
||||
const getApps = {
|
||||
type: GraphQLList(appType),
|
||||
args: {
|
||||
name: { type: GraphQLString }
|
||||
},
|
||||
resolve: (_: any, params: Params) => getAppsResolver(params)
|
||||
}
|
||||
|
||||
export default getApps;
|
||||
|
Reference in New Issue
Block a user