[mocks][s]: move graphql schema into separate file and add 'DatasetResponse' type.
This commit is contained in:
@@ -2,57 +2,7 @@ const { GraphQLScalarType } = require('graphql');
|
|||||||
const { ApolloServer } = require('apollo-server');
|
const { ApolloServer } = require('apollo-server');
|
||||||
const { makeExecutableSchema } = require('graphql-tools');
|
const { makeExecutableSchema } = require('graphql-tools');
|
||||||
const { importSchema } = require('graphql-import');
|
const { importSchema } = require('graphql-import');
|
||||||
const typeDefs = `
|
const typeDefs = importSchema('./schema.graphql');
|
||||||
type Query {
|
|
||||||
search(query: SearchQuery!): Response!
|
|
||||||
}
|
|
||||||
|
|
||||||
input SearchQuery {
|
|
||||||
q: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Response {
|
|
||||||
success: Boolean!
|
|
||||||
result: Result!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Result {
|
|
||||||
count: Int!
|
|
||||||
sort: String!
|
|
||||||
facets: String!
|
|
||||||
search_facets: String!
|
|
||||||
results: [Package!]!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Package {
|
|
||||||
name: String!
|
|
||||||
title: String!
|
|
||||||
notes: String!
|
|
||||||
resources: [Resource!]!
|
|
||||||
organization: Organization!
|
|
||||||
metadata_created: String!
|
|
||||||
metadata_modified: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Resource {
|
|
||||||
name: String!
|
|
||||||
id: String!
|
|
||||||
title: String!
|
|
||||||
format: String!
|
|
||||||
created: String!
|
|
||||||
last_modified: String!
|
|
||||||
datastore_active: Boolean!
|
|
||||||
url: String!
|
|
||||||
}
|
|
||||||
|
|
||||||
type Organization {
|
|
||||||
name: String!
|
|
||||||
title: String!
|
|
||||||
description: String!
|
|
||||||
created: String!
|
|
||||||
image_url: String!
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
Query: {
|
Query: {
|
||||||
|
|||||||
58
mock/schema.graphql
Normal file
58
mock/schema.graphql
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
type Query {
|
||||||
|
search(query: SearchQuery!): Response!
|
||||||
|
}
|
||||||
|
|
||||||
|
type Query {
|
||||||
|
dataset(id: String!): DatasetResponse!
|
||||||
|
}
|
||||||
|
|
||||||
|
input SearchQuery {
|
||||||
|
q: String!
|
||||||
|
}
|
||||||
|
|
||||||
|
type Response {
|
||||||
|
success: Boolean!
|
||||||
|
result: Result!
|
||||||
|
}
|
||||||
|
|
||||||
|
type DatasetResponse {
|
||||||
|
success: Boolean!
|
||||||
|
result: Package!
|
||||||
|
}
|
||||||
|
|
||||||
|
type Result {
|
||||||
|
count: Int!
|
||||||
|
sort: String!
|
||||||
|
facets: String!
|
||||||
|
search_facets: String!
|
||||||
|
results: [Package!]!
|
||||||
|
}
|
||||||
|
|
||||||
|
type Package {
|
||||||
|
name: String!
|
||||||
|
title: String!
|
||||||
|
notes: String!
|
||||||
|
resources: [Resource!]!
|
||||||
|
organization: Organization!
|
||||||
|
metadata_created: String!
|
||||||
|
metadata_modified: String!
|
||||||
|
}
|
||||||
|
|
||||||
|
type Resource {
|
||||||
|
name: String!
|
||||||
|
id: String!
|
||||||
|
title: String!
|
||||||
|
format: String!
|
||||||
|
created: String!
|
||||||
|
last_modified: String!
|
||||||
|
datastore_active: Boolean!
|
||||||
|
url: String!
|
||||||
|
}
|
||||||
|
|
||||||
|
type Organization {
|
||||||
|
name: String!
|
||||||
|
title: String!
|
||||||
|
description: String!
|
||||||
|
created: String!
|
||||||
|
image_url: String!
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user